Fix memmem test for mingw.
authorEric Blake <ebb9@byu.net>
Sat, 5 Jan 2008 11:47:05 +0000 (04:47 -0700)
committerEric Blake <ebb9@byu.net>
Sat, 5 Jan 2008 11:47:05 +0000 (04:47 -0700)
* modules/memmem-tests (configure.ac): Check for alarm.
* tests/test-memmem.c (main): Avoid alarm on platforms that lack
it.
* doc/functions/memmem.texi: New file.
* doc/gnulib.texi (Function Substitutes): Add memmem.
Reported by Bruno Haible.

Signed-off-by: Eric Blake <ebb9@byu.net>
ChangeLog
doc/functions/memmem.texi [new file with mode: 0644]
doc/gnulib.texi
modules/memmem-tests
tests/test-memmem.c

index bdf61e2..b4be78e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2008-01-05  Eric Blake  <ebb9@byu.net>
+
+       Fix memmem test for mingw.
+       * modules/memmem-tests (configure.ac): Check for alarm.
+       * tests/test-memmem.c (main): Avoid alarm on platforms that lack
+       it.
+       * doc/functions/memmem.texi: New file.
+       * doc/gnulib.texi (Function Substitutes): Add memmem.
+       Reported by Bruno Haible.
+
 2008-01-04  Bruno Haible  <bruno@clisp.org>
 
        * m4/strcase.m4 (gl_FUNC_STRCASECMP, gl_FUNC_STRNCASECMP):
diff --git a/doc/functions/memmem.texi b/doc/functions/memmem.texi
new file mode 100644 (file)
index 0000000..50d73fd
--- /dev/null
@@ -0,0 +1,28 @@
+@node memmem
+@section @code{memmem}
+@findex memmem
+
+Unspecified by POSIX, but comparable to @code{strstr}.
+
+Gnulib module: memmem
+
+Portability problems fixed by Gnulib:
+@itemize
+@item
+This function fails to return the start of the haystack for an empty
+needle on some platforms:
+Cygwin 1.5.x
+
+@item
+This function has quadratic instead of linear complexity on some
+platforms:
+glibc <= 2.6.1
+
+@item
+This function is missing on some platforms:
+Mingw, OpenBSD 4.0
+@end itemize
+
+Portability problems not fixed by Gnulib:
+@itemize
+@end itemize
index f46096b..deaf528 100644 (file)
@@ -17,7 +17,8 @@ This manual is for GNU Gnulib (updated @value{UPDATED}),
 which is a library of common routines intended to be shared at the
 source level.
 
-Copyright @copyright{} 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+Copyright @copyright{} 2004, 2005, 2006, 2007, 2008 Free Software
+Foundation, Inc.
 
 Permission is granted to copy, distribute and/or modify this document
 under the terms of the GNU Free Documentation License, Version 1.1 or
@@ -1174,6 +1175,7 @@ If you need this particular function, you may write to
 * memchr::
 * memcmp::
 * memcpy::
+* memmem::
 * memmove::
 * memset::
 * mkdir::
index 3d79e47..c9365e9 100644 (file)
@@ -4,6 +4,7 @@ tests/test-memmem.c
 Depends-on:
 
 configure.ac:
+AC_CHECK_DECLS_ONCE([alarm])
 
 Makefile.am:
 TESTS += test-memmem
index df3baef..976f293 100644 (file)
 int
 main (int argc, char *argv[])
 {
+#if HAVE_DECL_ALARM
   /* Declare failure if test takes too long, by using default abort
-     caused by SIGALRM.  */
+     caused by SIGALRM.  All known platforms that lack alarm also lack
+     memmem, and the replacement memmem is known to not take too
+     long.  */
   alarm (10);
+#endif
+
   {
     const char input[] = "foo";
     const char *result = memmem (input, strlen (input), "", 0);