diff options
author | Eric Blake <ebb9@byu.net> | 2007-12-19 16:09:03 -0700 |
---|---|---|
committer | Eric Blake <ebb9@byu.net> | 2007-12-20 06:02:01 -0700 |
commit | fc068cf4eb6814e848e4dc54e1c5cf4c30a79a6f (patch) | |
tree | a195a67b5ddd7d22b8c62277871cab7435cc7b54 /modules/string | |
parent | e323f261972032e4a1eeee6102c2327e97c808df (diff) | |
download | gnulib-fc068cf4eb6814e848e4dc54e1c5cf4c30a79a6f.tar.gz |
Fix memmem to avoid O(n^2) worst-case complexity.
* lib/memmem.c (knuth_morris_pratt): New function.
(memmem): Use it if first few naive iterations fail.
* m4/memmem.m4 (gl_FUNC_MEMMEM): Detect cygwin bug.
* modules/memcmp (License): Set to LGPLv2+, not LGPL.
* modules/memchr (License): Likewise.
* modules/memmem (Depends-on): Add memcmp, memchr, stdbool, and
malloca.
* tests/test-memmem.c: Rewrite, borrowing ideas from
test-mbsstr1.c; the old version wouldn't even compile!
* modules/memmem-tests: New file.
* lib/string.in.h (rpl_memmem): Add declaration.
* modules/string (Makefile.am): Substitute REPLACE_MEMMEM.
* m4/string_h.m4 (gl_HEADER_STRING_H_DEFAULTS): Default for
REPLACE_MEMMEM.
Signed-off-by: Eric Blake <ebb9@byu.net>
Diffstat (limited to 'modules/string')
-rw-r--r-- | modules/string | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/modules/string b/modules/string index 505ae6a530..6f3226d0fe 100644 --- a/modules/string +++ b/modules/string @@ -66,6 +66,7 @@ string.h: string.in.h -e 's|@''HAVE_STRCASESTR''@|$(HAVE_STRCASESTR)|g' \ -e 's|@''HAVE_DECL_STRTOK_R''@|$(HAVE_DECL_STRTOK_R)|g' \ -e 's|@''HAVE_DECL_STRERROR''@|$(HAVE_DECL_STRERROR)|g' \ + -e 's|@''REPLACE_MEMMEM''@|$(REPLACE_MEMMEM)|g' \ -e 's|@''REPLACE_STRERROR''@|$(REPLACE_STRERROR)|g' \ -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ < $(srcdir)/string.in.h; \ |