aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src/indexers/taketwo.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2020-08-20 11:16:15 +0200
committerThomas White <taw@physics.org>2020-08-20 11:16:15 +0200
commitd9e011c9e3f877ed95482fd54a549c065ff9b8be (patch)
tree2983933be34814995b449fe78362bf4ea180e5b1 /libcrystfel/src/indexers/taketwo.c
parenta0e9410fae73b1c91e21f8748a39164691895c6f (diff)
Add default_method_options()
This allows the indexing method private options structures to be set up easily.
Diffstat (limited to 'libcrystfel/src/indexers/taketwo.c')
-rw-r--r--libcrystfel/src/indexers/taketwo.c25
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 :