aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2013-11-26 05:14:57 -0800
committerThomas White <taw@physics.org>2014-05-08 17:52:02 +0200
commit1bc44dd21dc49a3920431cfee4495a28a45df622 (patch)
tree951831597e5a1503f4e83eaf4a363bac41528056 /src
parent2400441598cd7876949f6b1ed52c14b6e469368c (diff)
Strip out the "prepare_filename" rubbish
Diffstat (limited to 'src')
-rw-r--r--src/im-sandbox.c29
-rw-r--r--src/im-sandbox.h3
-rw-r--r--src/indexamajig.c28
3 files changed, 13 insertions, 47 deletions
diff --git a/src/im-sandbox.c b/src/im-sandbox.c
index 2c6e44ee..3558c8ea 100644
--- a/src/im-sandbox.c
+++ b/src/im-sandbox.c
@@ -124,8 +124,7 @@ static void unlock_sandbox(struct sandbox *sb)
}
-static char *get_pattern(FILE *fh, char **use_this_one_instead,
- int config_basename, const char *prefix)
+static char *get_pattern(FILE *fh, int config_basename, const char *prefix)
{
char *line;
char *filename;
@@ -134,22 +133,13 @@ static char *get_pattern(FILE *fh, char **use_this_one_instead,
do {
/* Get the next filename */
- if ( *use_this_one_instead != NULL ) {
-
- line = *use_this_one_instead;
- *use_this_one_instead = NULL;
-
- } else {
-
- char *rval;
-
- line = malloc(1024*sizeof(char));
- rval = fgets(line, 1023, fh);
- if ( rval == NULL ) {
- free(line);
- return NULL;
- }
+ char *rval;
+ line = malloc(1024*sizeof(char));
+ rval = fgets(line, 1023, fh);
+ if ( rval == NULL ) {
+ free(line);
+ return NULL;
}
chomp(line);
@@ -627,7 +617,7 @@ static void handle_zombie(struct sandbox *sb)
void create_sandbox(struct index_args *iargs, int n_proc, char *prefix,
- int config_basename, FILE *fh, char *use_this_one_instead,
+ int config_basename, FILE *fh,
int ofd, int argc, char *argv[], const char *tempdir)
{
int i;
@@ -853,8 +843,7 @@ void create_sandbox(struct index_args *iargs, int n_proc, char *prefix,
}
/* Send next filename */
- nextImage = get_pattern(fh, &use_this_one_instead,
- config_basename, prefix);
+ nextImage = get_pattern(fh, config_basename, prefix);
free(sb->last_filename[i]);
sb->last_filename[i] = nextImage;
diff --git a/src/im-sandbox.h b/src/im-sandbox.h
index c0c8eba4..71af5052 100644
--- a/src/im-sandbox.h
+++ b/src/im-sandbox.h
@@ -37,6 +37,5 @@
#include "process_image.h"
extern void create_sandbox(struct index_args *iargs, int n_proc, char *prefix,
- int config_basename, FILE *fh,
- char *use_this_one_instead, int streamfd,
+ int config_basename, FILE *fh, int streamfd,
int argc, char *argv[], const char *tempdir);
diff --git a/src/indexamajig.c b/src/indexamajig.c
index ab148a0b..c41b1487 100644
--- a/src/indexamajig.c
+++ b/src/indexamajig.c
@@ -177,7 +177,6 @@ int main(int argc, char *argv[])
char *outfile = NULL;
FILE *fh;
int ofd;
- char *rval = NULL;
int config_checkprefix = 1;
int config_basename = 0;
int integrate_saturated = 0;
@@ -189,9 +188,6 @@ int main(int argc, char *argv[])
char *speaks = NULL;
char *toler = NULL;
int n_proc = 1;
- char *prepare_line;
- char prepare_filename[1024];
- char *use_this_one_instead;
struct index_args iargs;
char *intrad = NULL;
char *int_str = NULL;
@@ -630,28 +626,10 @@ int main(int argc, char *argv[])
}
free(outfile);
- /* Get first filename and use it to set up the indexing */
- prepare_line = malloc(1024);
- rval = fgets(prepare_line, 1023, fh);
- if ( rval == NULL ) {
- ERROR("Failed to get filename to prepare indexing.\n");
- return 1;
- }
- use_this_one_instead = strdup(prepare_line);
- chomp(prepare_line);
- if ( config_basename ) {
- char *tmp;
- tmp = safe_basename(prepare_line);
- free(prepare_line);
- prepare_line = tmp;
- }
- snprintf(prepare_filename, 1023, "%s%s", prefix, prepare_line);
- free(prepare_line);
-
/* Prepare the indexer */
if ( indm != NULL ) {
- ipriv = prepare_indexing(indm, iargs.cell, prepare_filename,
- iargs.det, iargs.beam, iargs.tols);
+ ipriv = prepare_indexing(indm, iargs.cell, iargs.det,
+ iargs.beam, iargs.tols);
if ( ipriv == NULL ) {
ERROR("Failed to prepare indexing.\n");
return 1;
@@ -666,7 +644,7 @@ int main(int argc, char *argv[])
iargs.ipriv = ipriv;
create_sandbox(&iargs, n_proc, prefix, config_basename, fh,
- use_this_one_instead, ofd, argc, argv, tempdir);
+ ofd, argc, argv, tempdir);
free(prefix);
free(tempdir);