diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2017-09-13 09:08:49 +0200 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2017-09-14 18:30:47 +0200 |
| commit | dd761bbd09c8684adae9c783ef3d2d20cf5e06ad (patch) | |
| tree | 34b3fd0169eec32ab48fe3cf5d2785d868049406 /lib.c | |
| parent | f28fb7268ce372c6c0c4bf10b1153017f6f8a994 (diff) | |
| download | sparse-dev-dd761bbd09c8684adae9c783ef3d2d20cf5e06ad.tar.gz | |
option: use OPTION_NUMERIC() for handle_switch_fmemcpy_max_count()
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'lib.c')
| -rw-r--r-- | lib.c | 22 |
1 files changed, 5 insertions, 17 deletions
@@ -536,6 +536,8 @@ static int opt_##NAME(char *arg, const char *name, TYPE *ptr, int flag) \ return 1; \ } +OPT_NUMERIC(ullong, unsigned long long, strtoull) + static char **handle_switch_o(char *arg, char **next) { @@ -726,21 +728,6 @@ static char **handle_switch_O(char *arg, char **next) return next; } -static char **handle_switch_fmemcpy_max_count(char *arg, char **next) -{ - unsigned long long val; - char *end; - - val = strtoull(arg, &end, 0); - if (*end != '\0' || end == arg) - die("error: missing argument to \"-fmemcpy-max-count=\""); - - if (val == 0) - val = ~0ULL; - fmemcpy_max_count = val; - return next; -} - static char **handle_switch_ftabstop(char *arg, char **next) { char *end; @@ -791,8 +778,9 @@ static char **handle_switch_f(char *arg, char **next) return handle_switch_ftabstop(opt, next); if ((opt = match_option(arg, "dump-"))) return handle_switch_fdump(opt, next); - if ((opt = match_option(arg, "memcpy-max-count="))) - return handle_switch_fmemcpy_max_count(opt, next); + if (opt_ullong(arg, "-fmemcpy-max-count=", &fmemcpy_max_count, + OPTNUM_ZERO_IS_INF|OPTNUM_UNLIMITED)) + return next; /* handle switches w/ arguments above, boolean and only boolean below */ if (handle_simple_switch(arg, fflags)) |
