summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2023-03-27 15:41:30 +0200
committerBruno Haible <bruno@clisp.org>2023-03-27 15:41:30 +0200
commit9411c5e467cf60f6295b9fed306029f341a0f24f (patch)
treed004f4ae2ddab9e649df6df4c716aa982d6fe119 /doc
parent5a9a1ea612598404bca0e4c5dbb9505ed36fd11d (diff)
downloadgnulib-9411c5e467cf60f6295b9fed306029f341a0f24f.tar.gz
wcsstr: Ensure worst-case linear execution time.
* lib/wchar.in.h (wcsstr): Consider REPLACE_WCSSTR. * lib/wcs-two-way.h: New file, based on lib/str-two-way.h. * lib/wcsstr-impl.h: If requested, use the two-way algorithm. New code based on lib/strstr.c. * m4/wcsstr.m4 (gl_FUNC_WCSSTR_SIMPLE): Renamed from gl_FUNC_WCSSTR. (gl_FUNC_WCSSTR): New macro, based on gl_FUNC_STRSTR in m4/strstr.m4. * m4/wchar_h.m4 (gl_WCHAR_H_DEFAULTS): Initialize REPLACE_WCSSTR. * modules/wchar (Makefile.am): Substitute REPLACE_WCSSTR. * modules/wcsstr-simple: New file, based on modules/wcsstr. * modules/wcsstr (Description): Document that this module now provides an efficient implementation. (Files): Add lib/wcs-two-way.h. (Depends-on): Depend on wcsstr-simple and the dependencies of the two-way implementation. (configure.ac): Use AC_LIBOBJ instead of a conditional. Don't invoke gl_WCHAR_MODULE_INDICATOR. (Makefile.am): Don't augment lib_SOURCES. * tests/test-wcsstr.c: New file, based on tests/test-strstr.c. * modules/wcsstr-tests: New file, based on modules/strstr-tests. * doc/posix-functions/wcsstr.texi: Mention the worst-case complexity. Mention the new 'wcsstr-simple' module. * doc/posix-functions/strstr.texi: Fix typo.
Diffstat (limited to 'doc')
-rw-r--r--doc/posix-functions/strstr.texi2
-rw-r--r--doc/posix-functions/wcsstr.texi12
2 files changed, 11 insertions, 3 deletions
diff --git a/doc/posix-functions/strstr.texi b/doc/posix-functions/strstr.texi
index 1b124a0e53..3a36cfdeed 100644
--- a/doc/posix-functions/strstr.texi
+++ b/doc/posix-functions/strstr.texi
@@ -21,7 +21,7 @@ This function may fail to find matches on some platforms:
glibc 2.28.
@end itemize
-Portability problems fixed by Gnulib @code{strstr}:
+Portability problems fixed by Gnulib module @code{strstr}:
@itemize
@item
This function has quadratic instead of linear worst-case complexity on some
diff --git a/doc/posix-functions/wcsstr.texi b/doc/posix-functions/wcsstr.texi
index c5711d0821..e69a036658 100644
--- a/doc/posix-functions/wcsstr.texi
+++ b/doc/posix-functions/wcsstr.texi
@@ -4,15 +4,23 @@
POSIX specification:@* @url{https://pubs.opengroup.org/onlinepubs/9699919799/functions/wcsstr.html}
-Gnulib module: wcsstr
+Gnulib module: wcsstr or wcsstr-simple
-Portability problems fixed by Gnulib:
+Portability problems fixed by either Gnulib module @code{wcsstr-simple} or @code{wcsstr}:
@itemize
@item
This function is missing on some platforms:
HP-UX 11.00.
@end itemize
+Portability problems fixed by Gnulib module @code{wcsstr}:
+@itemize
+@item
+This function has quadratic instead of linear worst-case complexity on some
+platforms:
+glibc 2.37, macOS 12.5, FreeBSD 13.1, NetBSD 9.0, OpenBSD 7.2, AIX 7.2, HP-UX 11, IRIX 6.5, Solaris 11.4, Cygwin 2.9.0, mingw, MSVC 14.
+@end itemize
+
Portability problems not fixed by Gnulib:
@itemize
@item