summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog10
-rw-r--r--doc/glibc-functions/strchrnul.texi2
-rw-r--r--lib/string.in.h7
-rw-r--r--m4/strchrnul.m419
4 files changed, 25 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index 5a70916e23..7739d23d72 100644
--- 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
diff --git a/doc/glibc-functions/strchrnul.texi b/doc/glibc-functions/strchrnul.texi
index 610e935cdc..f108c54063 100644
--- a/doc/glibc-functions/strchrnul.texi
+++ b/doc/glibc-functions/strchrnul.texi
@@ -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
diff --git a/lib/string.in.h b/lib/string.in.h
index 7f156aa453..f120a1b094 100644
--- a/lib/string.in.h
+++ b/lib/string.in.h
@@ -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
diff --git a/m4/strchrnul.m4 b/m4/strchrnul.m4
index 52e50a121f..fbfd5aebd5 100644
--- a/m4/strchrnul.m4
+++ b/m4/strchrnul.m4
@@ -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
])