diff --git a/include/extopts/extopts.h b/include/extopts/extopts.h index dee0e93..5bb1f07 100644 --- a/include/extopts/extopts.h +++ b/include/extopts/extopts.h @@ -56,7 +56,6 @@ enum extopt_argtype { EXTOPT_ARGTYPE_LDOUBLE, /* Strings */ EXTOPT_ARGTYPE_STR, /* Field 'const_str' is used instead of 'addr' */ - EXTOPT_ARGTYPE_STR_ALLOC, EXTOPT_ARGTYPE_CHAR, }; @@ -147,11 +146,6 @@ struct extopt { .arg_name = NAME, \ .arg_type = EXTOPT_ARGTYPE_STR, \ .arg.const_str = ADDR -#define EXTOPT_ARG_STR_ALLOC(NAME, ADDR) \ - .has_arg = required_extarg, \ - .arg_name = NAME, \ - .arg_type = EXTOPT_ARGTYPE_STR_ALLOC, \ - .arg.addr = ADDR #define EXTOPT_ARG_CHAR(NAME, ADDR) \ .has_arg = required_extarg, \ .arg_name = NAME, \ diff --git a/src/example/modules.c b/src/example/modules.c index a3beb75..8ae0a17 100644 --- a/src/example/modules.c +++ b/src/example/modules.c @@ -15,7 +15,6 @@ float opts_float; double opts_double; long double opts_ldouble; const char *opts_str; -char opts_alloc_str[256]; char opts_char; struct extopt int_opts[] = { @@ -80,10 +79,6 @@ struct extopt str_opts[] = { .name_long = "str", EXTOPT_ARG_STR("STR", &opts_str), .desc = "string option", - }, { - .name_long = "str-alloc", - EXTOPT_ARG_STR_ALLOC("STR", &opts_alloc_str), - .desc = "allocated string option", }, { .name_long = "char", EXTOPT_ARG_CHAR("SYMBOL", &opts_char), @@ -210,7 +205,6 @@ int str_module(int argc, char *argv[]) printf("Configurable parameters list:\n"); printf(" opts_str = %s\n", opts_str); - printf(" opts_alloc_str = %s\n", opts_alloc_str); printf(" opts_char = %c\n", opts_char); err: @@ -229,4 +223,4 @@ EXTMOD_DECL(float, float_module, float_opts, "(float, double, long double)", NULL) EXTMOD_DECL(str, str_module, str_opts, "Testing string arguments parsing " - "(strings, pre-allocated strings, chars)", NULL) + "(strings, chars)", NULL) diff --git a/src/extopts.c b/src/extopts.c index fea8974..750745b 100644 --- a/src/extopts.c +++ b/src/extopts.c @@ -207,9 +207,6 @@ int default_setter(struct extopt *opt, const char *arg) case EXTOPT_ARGTYPE_STR: *opt->arg.const_str = arg; break; - case EXTOPT_ARGTYPE_STR_ALLOC: - strcpy(opt->arg.addr, arg); - break; case EXTOPT_ARGTYPE_INT: case EXTOPT_ARGTYPE_LINT: case EXTOPT_ARGTYPE_LLINT: @@ -241,7 +238,6 @@ char *get_argtype_name(enum extopt_argtype argtype) switch(argtype) { case EXTOPT_ARGTYPE_NO_ARG: return "NO_ARG"; case EXTOPT_ARGTYPE_STR: return "STR"; - case EXTOPT_ARGTYPE_STR_ALLOC: return "STR"; case EXTOPT_ARGTYPE_INT: return "INT"; case EXTOPT_ARGTYPE_LINT: return "LINT"; case EXTOPT_ARGTYPE_LLINT: return "LLINT";