From: Akim Demaille Date: Thu, 14 Feb 2013 13:57:18 +0000 (+0100) Subject: getargs: minor simplification X-Git-Tag: v2.7.90~93 X-Git-Url: https://git.saurik.com/bison.git/commitdiff_plain/9e4917b2a146c60f47c96916f2eaad9b43af82c5 getargs: minor simplification * src/getargs.c (flag_argmatch): Simplify the handling of "none". --- diff --git a/src/getargs.c b/src/getargs.c index fd96fe17..82c12983 100644 --- a/src/getargs.c +++ b/src/getargs.c @@ -84,23 +84,19 @@ flag_argmatch (const char *option, const char * const keys[], const int values[], int all, int *flags, char *arg, size_t no) { - int value = 0; - value = XARGMATCH (option, arg + no, keys, values); + int value = XARGMATCH (option, arg + no, keys, values); - if (value) + /* -rnone == -rno-all, and -rno-none == -rall. */ + if (!value) { - if (no) - *flags &= ~value; - else - *flags |= value; + value = all; + no = !no; } + + if (no) + *flags &= ~value; else - { - if (no) - *flags |= all; - else - *flags &= ~all; - } + *flags |= value; } /** Decode an option's set of keys.