aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2010-06-11 15:42:45 -0700
committerThomas White <taw@bitwiz.org.uk>2010-06-11 15:44:16 -0700
commit0559d06f61cd3f30b5925fe062654eca83eb6dd6 (patch)
tree7c4d588b4827ddeede470b405c3ea511f3a8bfd2 /src
parente5adbd4bdf620467c44a7ad99a366e39f04578a2 (diff)
Tidy up switch statements
Diffstat (limited to 'src')
-rw-r--r--src/compare_hkl.c18
-rw-r--r--src/get_hkl.c21
-rw-r--r--src/hdfsee.c18
-rw-r--r--src/indexamajig.c30
-rw-r--r--src/pattern_sim.c33
-rw-r--r--src/powder_plot.c15
-rw-r--r--src/process_hkl.c31
-rw-r--r--src/render_hkl.c61
8 files changed, 81 insertions, 146 deletions
diff --git a/src/compare_hkl.c b/src/compare_hkl.c
index f58c5046..9f39ee09 100644
--- a/src/compare_hkl.c
+++ b/src/compare_hkl.c
@@ -67,34 +67,28 @@ int main(int argc, char *argv[])
while ((c = getopt_long(argc, argv, "ho:a:b:", longopts, NULL)) != -1) {
switch (c) {
- case 'h' : {
+ case 'h' :
show_help(argv[0]);
return 0;
- }
- case 'o' : {
+ case 'o' :
outfile = strdup(optarg);
break;
- }
- case 'a' : {
+ case 'a' :
afile = strdup(optarg);
break;
- }
- case 'b' : {
+ case 'b' :
bfile = strdup(optarg);
break;
- }
- case 0 : {
+ case 0 :
break;
- }
- default : {
+ default :
return 1;
}
- }
}
diff --git a/src/get_hkl.c b/src/get_hkl.c
index e6fe4cee..c98508ec 100644
--- a/src/get_hkl.c
+++ b/src/get_hkl.c
@@ -136,39 +136,32 @@ int main(int argc, char *argv[])
while ((c = getopt_long(argc, argv, "ht:o:i:p:", longopts, NULL)) != -1) {
switch (c) {
- case 'h' : {
+ case 'h' :
show_help(argv[0]);
return 0;
- }
- case 't' : {
+ case 't' :
template = strdup(optarg);
break;
- }
- case 'o' : {
+ case 'o' :
output = strdup(optarg);
break;
- }
- case 'i' : {
+ case 'i' :
input = strdup(optarg);
break;
- }
- case 'p' : {
+ case 'p' :
filename = strdup(optarg);
break;
- }
- case 0 : {
+ case 0 :
break;
- }
- default : {
+ default :
return 1;
}
- }
}
diff --git a/src/hdfsee.c b/src/hdfsee.c
index ff74ead6..de150df2 100644
--- a/src/hdfsee.c
+++ b/src/hdfsee.c
@@ -101,41 +101,35 @@ int main(int argc, char *argv[])
while ((c = getopt_long(argc, argv, "hp:b:i:", longopts, NULL)) != -1) {
switch (c) {
- case 'h' : {
+ case 'h' :
show_help(argv[0]);
return 0;
- }
- case 'p' : {
+ case 'p' :
peaks = strdup(optarg);
break;
- }
- case 'i' : {
+ case 'i' :
boost = atoi(optarg);
if ( boost < 1 ) {
ERROR("Intensity boost must be a positive"
" integer.\n");
}
break;
- }
- case 'b' : {
+ case 'b' :
binning = atoi(optarg);
if ( boost < 1 ) {
ERROR("Binning must be a positive integer.\n");
}
break;
- }
- case 0 : {
+ case 0 :
break;
- }
- default : {
+ default :
return 1;
}
- }
}
diff --git a/src/indexamajig.c b/src/indexamajig.c
index 39ceea2b..d993adae 100644
--- a/src/indexamajig.c
+++ b/src/indexamajig.c
@@ -457,54 +457,44 @@ int main(int argc, char *argv[])
longopts, NULL)) != -1) {
switch (c) {
- case 'h' : {
+ case 'h' :
show_help(argv[0]);
return 0;
- }
- case 'i' : {
+ case 'i' :
filename = strdup(optarg);
break;
- }
- case 'z' : {
+ case 'z' :
indm_str = strdup(optarg);
break;
- }
- case 'q' : {
+ case 'q' :
intfile = strdup(optarg);
break;
- }
- case 'p' : {
+ case 'p' :
pdb = strdup(optarg);
break;
- }
- case 'x' : {
+ case 'x' :
prefix = strdup(optarg);
break;
- }
- case 'j' : {
+ case 'j' :
nthreads = atoi(optarg);
break;
- }
- case 'g' : {
+ case 'g' :
geometry = strdup(optarg);
break;
- }
- case 0 : {
+ case 0 :
break;
- }
- default : {
+ default :
return 1;
}
- }
}
diff --git a/src/pattern_sim.c b/src/pattern_sim.c
index 44963b9d..1f12caa2 100644
--- a/src/pattern_sim.c
+++ b/src/pattern_sim.c
@@ -222,59 +222,48 @@ int main(int argc, char *argv[])
longopts, NULL)) != -1) {
switch (c) {
- case 'h' : {
+ case 'h' :
show_help(argv[0]);
return 0;
- }
- case 'r' : {
+ case 'r' :
config_randomquat = 1;
break;
- }
- case 'n' : {
+ case 'n' :
n_images = atoi(optarg);
break;
- }
- case 'i' : {
+ case 'i' :
intfile = strdup(optarg);
break;
- }
- case 't' : {
+ case 't' :
grad_str = strdup(optarg);
break;
- }
- case 'p' : {
+ case 'p' :
filename = strdup(optarg);
break;
- }
- case 'o' : {
+ case 'o' :
outfile = strdup(optarg);
break;
- }
- case 'w' : {
+ case 'w' :
powder_fn = strdup(optarg);
break;
- }
- case 'g' : {
+ case 'g' :
geometry = strdup(optarg);
break;
- }
- case 0 : {
+ case 0 :
break;
- }
- default : {
+ default :
return 1;
}
- }
}
diff --git a/src/powder_plot.c b/src/powder_plot.c
index 01a4328e..f0d30553 100644
--- a/src/powder_plot.c
+++ b/src/powder_plot.c
@@ -62,29 +62,24 @@ int main(int argc, char *argv[])
while ((c = getopt_long(argc, argv, "hi:g:", longopts, NULL)) != -1) {
switch (c) {
- case 'h' : {
+ case 'h' :
show_help(argv[0]);
return 0;
- }
- case 0 : {
+ case 0 :
break;
- }
- case 'i' : {
+ case 'i' :
filename = strdup(optarg);
break;
- }
- case 'g' : {
+ case 'g' :
geometry = strdup(optarg);
break;
- }
- default : {
+ default :
return 1;
}
- }
}
diff --git a/src/process_hkl.c b/src/process_hkl.c
index 8698b30a..d5d934c9 100644
--- a/src/process_hkl.c
+++ b/src/process_hkl.c
@@ -272,54 +272,45 @@ int main(int argc, char *argv[])
while ((c = getopt_long(argc, argv, "hi:e:ro:p:", longopts, NULL)) != -1) {
switch (c) {
- case 'h' : {
+ case 'h' :
show_help(argv[0]);
return 0;
- }
- case 'i' : {
+ case 'i' :
filename = strdup(optarg);
break;
- }
- case 'o' : {
+ case 'o' :
output = strdup(optarg);
break;
- }
- case 'r' : {
+
+ case 'r' :
config_rvsq = 1;
break;
- }
- case 'e' : {
+ case 'e' :
config_every = atoi(optarg);
break;
- }
- case 's' : {
+ case 's' :
config_stopafter = atoi(optarg);
break;
- }
- case 'c' : {
+ case 'c' :
intfile = strdup(optarg);
break;
- }
- case 'p' : {
+ case 'p' :
pdb = strdup(optarg);
break;
- }
- case 0 : {
+ case 0 :
break;
- }
- default : {
+ default :
return 1;
}
- }
}
diff --git a/src/render_hkl.c b/src/render_hkl.c
index e18ae90d..4e17e307 100644
--- a/src/render_hkl.c
+++ b/src/render_hkl.c
@@ -330,34 +330,27 @@ static void povray_render_animation(UnitCell *cell, double *ref,
s = 6;
}
switch ( s ) {
- case 0 : { /* Black to blue */
- r = 0.0; g = 0.0; b = p;
- break;
- }
- case 1 : { /* Blue to green */
- r = 0.0; g = p; b = 1.0-p;
- break;
- }
- case 2 : { /* Green to red */
- r =p; g = 1.0-p; b = 0.0;
- break;
- }
- case 3 : { /* Red to Orange */
- r = 1.0; g = 0.5*p; b = 0.0;
- break;
- }
- case 4 : { /* Orange to Yellow */
- r = 1.0; g = 0.5 + 0.5*p; b = 0.0;
- break;
- }
- case 5 : { /* Yellow to White */
- r = 1.0; g = 1.0; b = 1.0*p;
- break;
- }
- case 6 : { /* Pixel has hit the maximum value */
- r = 1.0; g = 1.0; b = 1.0;
- break;
- }
+ case 0 : /* Black to blue */
+ r = 0.0; g = 0.0; b = p;
+ break;
+ case 1 : /* Blue to green */
+ r = 0.0; g = p; b = 1.0-p;
+ break;
+ case 2 : /* Green to red */
+ r =p; g = 1.0-p; b = 0.0;
+ break;
+ case 3 : /* Red to Orange */
+ r = 1.0; g = 0.5*p; b = 0.0;
+ break;
+ case 4 : /* Orange to Yellow */
+ r = 1.0; g = 0.5 + 0.5*p; b = 0.0;
+ break;
+ case 5 : /* Yellow to White */
+ r = 1.0; g = 1.0; b = 1.0*p;
+ break;
+ case 6 : /* Pixel has hit the maximum value */
+ r = 1.0; g = 1.0; b = 1.0;
+ break;
}
val = max-val;
@@ -448,24 +441,20 @@ int main(int argc, char *argv[])
while ((c = getopt_long(argc, argv, "hj:", longopts, NULL)) != -1) {
switch (c) {
- case 'h' : {
+ case 'h' :
show_help(argv[0]);
return 0;
- }
- case 'j' : {
+ case 'j' :
nproc = atoi(optarg);
break;
- }
- case 0 : {
+ case 0 :
break;
- }
- default : {
+ default :
return 1;
}
- }
}