From: Niels Möller Date: Mon, 14 Mar 2016 09:37:55 +0000 (+0100) Subject: Fix c99-ism in getopt.c. Reported by Henrik Grubbström. X-Git-Tag: nettle_3.3_release_20161001~63 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=628a2c19610a521fdae7d4307eb3fecf5f7478e0;p=thirdparty%2Fnettle.git Fix c99-ism in getopt.c. Reported by Henrik Grubbström. --- diff --git a/ChangeLog b/ChangeLog index c9c522bf..cb941d5a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2016-03-14 Niels Möller + + * getopt.c (_getopt_internal_r): Fix c99-ism, move declarations to + top of block. Reported by Henrik Grubbström. + 2016-02-16 Niels Möller * tools/input.c (sexp_get_string_length): Process advanced string diff --git a/getopt.c b/getopt.c index 144a8b96..6be0aafa 100644 --- a/getopt.c +++ b/getopt.c @@ -870,9 +870,6 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring, /* Convenience. Treat POSIX -W foo same as long option --foo */ if (temp[0] == 'W' && temp[1] == ';') { - if (longopts == NULL) - goto no_longs; - char *nameend; const struct option *p; const struct option *pfound = NULL; @@ -881,6 +878,9 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring, int indfound = 0; int option_index; + if (longopts == NULL) + goto no_longs; + /* This is an option that requires an argument. */ if (*d->__nextchar != '\0') {