aboutsummaryrefslogtreecommitdiff
path: root/src/indexamajig.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2021-07-21 13:26:37 +0200
committerThomas White <taw@physics.org>2021-07-21 15:34:33 +0200
commit7e5536832b22036a634a74e16073b4762a416e29 (patch)
tree25799eb139d235f524a80c53fb25d0c9f64eb6f1 /src/indexamajig.c
parent760f17f56b7f79f67a9029cbe7cc55a0acccd3b9 (diff)
Reduce variable scope where possible
Diffstat (limited to 'src/indexamajig.c')
-rw-r--r--src/indexamajig.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/indexamajig.c b/src/indexamajig.c
index d9b0114d..9bbf7e5d 100644
--- a/src/indexamajig.c
+++ b/src/indexamajig.c
@@ -166,12 +166,11 @@ static void write_json_radii(FILE *fh, const char *name,
static void write_methods(FILE *fh, const char *name, IndexingPrivate *ipriv)
{
- int i, n;
- const IndexingMethod *methods;
-
fprintf(fh, " \"%s\": [", name);
if ( ipriv != NULL ) {
+ const IndexingMethod *methods;
+ int i, n;
methods = indexing_methods(ipriv, &n);
for ( i=0; i<n; i++ ) {
fprintf(fh, " \"%s\"", indexer_str(methods[i]));
@@ -190,7 +189,6 @@ static void write_harvest_file(struct index_args *args,
int if_peaks, int if_checkcell)
{
FILE *fh;
- char *tmp;
fh = fopen(filename, "w");
if ( fh == NULL ) {
@@ -234,6 +232,9 @@ static void write_harvest_file(struct index_args *args,
fprintf(fh, " \"indexing\": null\n");
fprintf(fh, " \"integration\": null\n");
} else {
+
+ char *tmp;
+
fprintf(fh, " \"indexing\": {\n");
write_methods(fh, "methods", args->ipriv);
write_json_cell(fh, "target_cell", args->cell);