regex-tests, regex: fix bug: memset undeclared
authorPaul Eggert <eggert@cs.ucla.edu>
Sun, 3 Feb 2013 17:19:06 +0000 (09:19 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Sun, 3 Feb 2013 17:19:34 +0000 (09:19 -0800)
* tests/test-regex.c: Don't include regex.h twice.  Include
string.h, to declare memset.  Christensen's report also mentioned
this issue.
* m4/regex.m4 (gl_REGEX): Keep test program more in sync with
test-regex.c, to avoid future problems like this.  Remove
AC_INCLUDES_DEFAULT.  Include <string.h>.  Don't include <regex.h>
twice.

ChangeLog
m4/regex.m4
tests/test-regex.c

index d369fb3..688b7e0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2013-02-03  Paul Eggert  <eggert@cs.ucla.edu>
 
+       regex-tests, regex: fix bug: memset undeclared
+       * tests/test-regex.c: Don't include regex.h twice.  Include
+       string.h, to declare memset.  Christensen's report also mentioned
+       this issue.
+       * m4/regex.m4 (gl_REGEX): Keep test program more in sync with
+       test-regex.c, to avoid future problems like this.  Remove
+       AC_INCLUDES_DEFAULT.  Include <string.h>.  Don't include <regex.h>
+       twice.
+
        regex-tests: fix link errors on older Solaris
        These need to link with @LIBINTL@ to get libintl_gettext.
        Problem reported by Tom G. Christensen in
index 958c663..ae89e31 100644 (file)
@@ -32,15 +32,16 @@ AC_DEFUN([gl_REGEX],
                    [gl_cv_func_re_compile_pattern_working],
       [AC_RUN_IFELSE(
         [AC_LANG_PROGRAM(
-          [AC_INCLUDES_DEFAULT[
-           #include <locale.h>
-           #include <limits.h>
-           #include <regex.h>
-           #if HAVE_ALARM
-           # include <unistd.h>
-           # include <signal.h>
-           #endif
-           ]],
+          [[#include <regex.h>
+
+            #include <locale.h>
+            #include <limits.h>
+            #include <string.h>
+            #if HAVE_ALARM
+            # include <unistd.h>
+            # include <signal.h>
+            #endif
+          ]],
           [[int result = 0;
             static struct re_pattern_buffer regex;
             unsigned char folded_chars[UCHAR_MAX + 1];
index e30a1e1..2488cee 100644 (file)
@@ -20,7 +20,7 @@
 
 #include <locale.h>
 #include <limits.h>
-#include <regex.h>
+#include <string.h>
 #if HAVE_ALARM
 # include <unistd.h>
 # include <signal.h>