strchrnul: Tweak last commit.
authorBruno Haible <bruno@clisp.org>
Sat, 16 Apr 2011 10:10:16 +0000 (12:10 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 16 Apr 2011 10:10:16 +0000 (12:10 +0200)
* doc/glibc-functions/strchrnul.texi: Add more details about Cygwin
bug.
* lib/string.in.h (strchrnul): Use same arguments in _GL_FUNCDECL_RPL
as in _GL_FUNCDECL_SYS.
* m4/strchrnul.m4 (gl_FUNC_STRCHRNUL): Invoke gl_PREREQ_STRCHRNUL after
AC_LIBOBJ. When cross-compiling, say "guessing yes" not "yes".

ChangeLog
doc/glibc-functions/strchrnul.texi
lib/string.in.h
m4/strchrnul.m4

index 5a70916..7739d23 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2011-04-16  Bruno Haible  <bruno@clisp.org>
+
+       strchrnul: Tweak last commit.
+       * doc/glibc-functions/strchrnul.texi: Add more details about Cygwin
+       bug.
+       * lib/string.in.h (strchrnul): Use same arguments in _GL_FUNCDECL_RPL
+       as in _GL_FUNCDECL_SYS.
+       * m4/strchrnul.m4 (gl_FUNC_STRCHRNUL): Invoke gl_PREREQ_STRCHRNUL after
+       AC_LIBOBJ. When cross-compiling, say "guessing yes" not "yes".
+
 2011-04-15  Eric Blake  <eblake@redhat.com>
 
        strchrnul: work around cygwin bug
index 610e935..f108c54 100644 (file)
@@ -12,7 +12,7 @@ MacOS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, AIX 5.1, HP-UX 11,
 IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 1.7.8, mingw, Interix 3.5,
 BeOS.
 @item
-This function is broken on some platforms:
+This function crashes when no occurrence is found on some platforms:
 Cygwin 1.7.9.
 @end itemize
 
index 7f156aa..f120a1b 100644 (file)
@@ -281,10 +281,9 @@ _GL_WARN_ON_USE (strchr, "strchr cannot work correctly on character strings "
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 #   define strchrnul rpl_strchrnul
 #  endif
-_GL_FUNCDECL_RPL (strchrnul, char *,
-                  (const char *str, int ch)
-                  _GL_ATTRIBUTE_PURE
-                  _GL_ARG_NONNULL ((1)));
+_GL_FUNCDECL_RPL (strchrnul, char *, (const char *__s, int __c_in)
+                                     _GL_ATTRIBUTE_PURE
+                                     _GL_ARG_NONNULL ((1)));
 _GL_CXXALIAS_RPL (strchrnul, char *,
                   (const char *str, int ch));
 # else
index 52e50a1..fbfd5ae 100644 (file)
@@ -10,17 +10,16 @@ AC_DEFUN([gl_FUNC_STRCHRNUL],
   AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
 
   AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
-  AC_REPLACE_FUNCS([strchrnul])
+  AC_CHECK_FUNCS([strchrnul])
   if test $ac_cv_func_strchrnul = no; then
     HAVE_STRCHRNUL=0
-    gl_PREREQ_STRCHRNUL
   else
     AC_CACHE_CHECK([whether strchrnul works],
       [gl_cv_func_strchrnul_works],
       [AC_RUN_IFELSE([AC_LANG_PROGRAM([[
 #include <string.h> /* for strchrnul */
 ]], [[const char *buf = "a";
-      return strchrnul(buf, 'b') != buf + 1;
+      return strchrnul (buf, 'b') != buf + 1;
     ]])],
         [gl_cv_func_strchrnul_works=yes],
         [gl_cv_func_strchrnul_works=no],
@@ -36,14 +35,18 @@ AC_DEFUN([gl_FUNC_STRCHRNUL],
   Lucky user
 #endif
            ],
-           [gl_cv_func_strchrnul_works=yes],
+           [gl_cv_func_strchrnul_works="guessing yes"],
            [gl_cv_func_strchrnul_works="guessing no"])
         ])
       ])
-    if test "$gl_cv_func_strchrnul_works" != yes; then
-      REPLACE_STRCHRNUL=1
-      AC_LIBOBJ([strchrnul])
-    fi
+    case "$gl_cv_func_strchrnul_works" in
+      *yes) ;;
+      *) REPLACE_STRCHRNUL=1 ;;
+    esac
+  fi
+  if test $HAVE_STRCHRNUL = 0 || test $REPLACE_STRCHRNUL = 1; then
+    AC_LIBOBJ([strchrnul])
+    gl_PREREQ_STRCHRNUL
   fi
 ])