]> git.ipfire.org Git - thirdparty/nettle.git/commitdiff
Fix c99-ism in getopt.c. Reported by Henrik Grubbström.
authorNiels Möller <nisse@lysator.liu.se>
Mon, 14 Mar 2016 09:37:55 +0000 (10:37 +0100)
committerNiels Möller <nisse@lysator.liu.se>
Mon, 14 Mar 2016 09:37:55 +0000 (10:37 +0100)
ChangeLog
getopt.c

index c9c522bf39b7d147f2b0e41c22a306a60fcb9eb0..cb941d5adb9bdf13f4e65730036b52c2f67a7a0e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2016-03-14  Niels Möller  <nisse@lysator.liu.se>
+
+       * 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  <nisse@lysator.liu.se>
 
        * tools/input.c (sexp_get_string_length): Process advanced string
index 144a8b964ed1c08e5a5e64c418ef580af51bb407..6be0aafa2801c1540215467f5d8eb8e29950f55f 100644 (file)
--- 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')
          {