# HG changeset patch # User Eric Blake # Date 1199533625 25200 # Node ID 72670d7544312a7e5baddcf8692e0278e969d729 # Parent 6858419c4f22fe42ac41f5ead249b4aee88d148e 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. Signed-off-by: Eric Blake diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2008-01-05 Eric Blake + + 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 * 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 --- /dev/null +++ b/doc/functions/memmem.texi @@ -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 diff --git a/doc/gnulib.texi b/doc/gnulib.texi --- a/doc/gnulib.texi +++ b/doc/gnulib.texi @@ -17,7 +17,8 @@ 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 @@ * memchr:: * memcmp:: * memcpy:: +* memmem:: * memmove:: * memset:: * mkdir:: diff --git a/modules/memmem-tests b/modules/memmem-tests --- a/modules/memmem-tests +++ b/modules/memmem-tests @@ -4,6 +4,7 @@ Depends-on: configure.ac: +AC_CHECK_DECLS_ONCE([alarm]) Makefile.am: TESTS += test-memmem diff --git a/tests/test-memmem.c b/tests/test-memmem.c --- a/tests/test-memmem.c +++ b/tests/test-memmem.c @@ -37,9 +37,14 @@ 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);