getopt: optimize previous patch
authorEric Blake <eblake@redhat.com>
Wed, 8 Sep 2010 14:49:15 +0000 (08:49 -0600)
committerEric Blake <eblake@redhat.com>
Wed, 8 Sep 2010 14:50:20 +0000 (08:50 -0600)
* m4/getopt.m4 (gl_GETOPT_CHECK_HEADERS): Correctly check for
empty variable.  Speed up awk script.
Reported by Paolo Bonzini.

Signed-off-by: Eric Blake <eblake@redhat.com>
ChangeLog
m4/getopt.m4

index 9a51377..e2b773c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
        glibc, and refer the reader there. Keep BSD API documentation, as
        that is not readily available elsewhere.
 
+2010-09-08  Eric Blake  <eblake@redhat.com>
+
+       getopt: optimize previous patch
+       * m4/getopt.m4 (gl_GETOPT_CHECK_HEADERS): Correctly check for
+       empty variable.  Speed up awk script.
+       Reported by Paolo Bonzini.
+
 2010-09-07  Eric Blake  <eblake@redhat.com>
 
        getopt: handle POSIXLY_CORRECT set but not exported
index 720f048..d05e9d9 100644 (file)
@@ -1,4 +1,4 @@
-# getopt.m4 serial 30
+# getopt.m4 serial 31
 dnl Copyright (C) 2002-2006, 2008-2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -218,9 +218,8 @@ main ()
        # so take care to revert to the correct (non-)export state.
 dnl GNU Coding Standards currently allow awk but not env; besides, env
 dnl is ambiguous with environment values that contain newlines.
-       gl_awk_probe='BEGIN { for (v in ENVIRON)
-         if (v == "POSIXLY_CORRECT") print "x" }'
-       case ${POSIXLY_CORRECT:+x}`$AWK "$gl_awk_probe" </dev/null` in
+       gl_awk_probe='BEGIN { if ("POSIXLY_CORRECT" in ENVIRON) print "x" }'
+       case ${POSIXLY_CORRECT+x}`$AWK "$gl_awk_probe" </dev/null` in
          xx) gl_had_POSIXLY_CORRECT=exported ;;
          x)  gl_had_POSIXLY_CORRECT=yes      ;;
          *)  gl_had_POSIXLY_CORRECT=         ;;