diff options
Diffstat (limited to 'libcrystfel/src/indexers/taketwo.c')
-rw-r--r-- | libcrystfel/src/indexers/taketwo.c | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/libcrystfel/src/indexers/taketwo.c b/libcrystfel/src/indexers/taketwo.c index 65265b0e..aef88582 100644 --- a/libcrystfel/src/indexers/taketwo.c +++ b/libcrystfel/src/indexers/taketwo.c @@ -2288,21 +2288,34 @@ static void taketwo_show_help() } +int taketwo_default_options(TakeTwoOptions **opts_ptr) +{ + TakeTwoOptions *opts; + + opts = malloc(sizeof(struct taketwo_options)); + if ( opts == NULL ) return ENOMEM; + opts->member_thresh = -1.0; + opts->len_tol = -1.0; + opts->angle_tol = -1.0; + opts->trace_tol = -1.0; + + *opts_ptr = opts; + return 0; +} + + static error_t taketwo_parse_arg(int key, char *arg, struct argp_state *state) { struct taketwo_options **opts_ptr = state->input; float tmp; + int r; switch ( key ) { case ARGP_KEY_INIT : - *opts_ptr = malloc(sizeof(struct taketwo_options)); - if ( *opts_ptr == NULL ) return ENOMEM; - (*opts_ptr)->member_thresh = -1.0; - (*opts_ptr)->len_tol = -1.0; - (*opts_ptr)->angle_tol = -1.0; - (*opts_ptr)->trace_tol = -1.0; + r = taketwo_default_options(opts_ptr); + if ( r ) return r; break; case 1 : |