diff options
author | Sami Kerola | 2014-12-06 19:21:56 +0100 |
---|---|---|
committer | Sami Kerola | 2014-12-08 21:07:01 +0100 |
commit | 0640689c209357611bd434091552839634f6af76 (patch) | |
tree | f0150effe9d283a6eedb63cc24f83f099b751bd8 /misc-utils/getopt.c | |
parent | getopt: make normalize() print strings (diff) | |
download | kernel-qcow2-util-linux-0640689c209357611bd434091552839634f6af76.tar.gz kernel-qcow2-util-linux-0640689c209357611bd434091552839634f6af76.tar.xz kernel-qcow2-util-linux-0640689c209357611bd434091552839634f6af76.zip |
getopt: remove unnecessary code
The control structure is initialized in main().
CC: Frodo Looijaard <frodo@frodo.looijaard.name>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'misc-utils/getopt.c')
-rw-r--r-- | misc-utils/getopt.c | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/misc-utils/getopt.c b/misc-utils/getopt.c index 696e87a19..67603b52e 100644 --- a/misc-utils/getopt.c +++ b/misc-utils/getopt.c @@ -232,14 +232,6 @@ static void add_longopt(struct getopt_control *ctl, const char *name, int has_ar { static int flag; - if (!name) { - /* init */ - free(ctl->long_options); - ctl->long_options = NULL; - ctl->long_options_length = 0; - ctl->long_options_nr = 0; - } - if (ctl->long_options_nr == ctl->long_options_length) { ctl->long_options_length += REALLOC_INCREMENT; ctl->long_options = xrealloc(ctl->long_options, @@ -252,7 +244,7 @@ static void add_longopt(struct getopt_control *ctl, const char *name, int has_ar ctl->long_options[ctl->long_options_nr].flag = NULL; ctl->long_options[ctl->long_options_nr].val = 0; - if (ctl->long_options_nr && name) { + if (name) { /* Not for init! */ ctl->long_options[ctl->long_options_nr - 1].has_arg = has_arg; ctl->long_options[ctl->long_options_nr - 1].flag = &flag; |