diff options
author | Eric Blake <eblake@redhat.com> | 2008-01-12 04:25:55 +0000 |
---|---|---|
committer | Eric Blake <eblake@redhat.com> | 2008-01-12 04:25:55 +0000 |
commit | 40617efc8b9309006af1f0c72425fc4a404f40d4 (patch) | |
tree | 5f97df24fcf156b492ae2123f201de1528abf0cf /newlib/libc/string/Makefile.am | |
parent | 978e84cf602994e44570fbac0c7adcd2ef5690e1 (diff) | |
download | cygnal-40617efc8b9309006af1f0c72425fc4a404f40d4.tar.gz cygnal-40617efc8b9309006af1f0c72425fc4a404f40d4.tar.bz2 cygnal-40617efc8b9309006af1f0c72425fc4a404f40d4.zip |
Make strstr and strcasestr O(n), not O(n^2); add memmem.
* libc/string/str-two-way.h: New file.
* libc/string/memmem.c (memmem): New file.
* libc/include/string.h (memmem): Declare for all platforms.
* libc/string/strstr.c (strstr): Provide O(n) implementation when
not optimizing for space.
* libc/string/strcasestr.c (strcasestr): Likewise.
* libc/string/Makefile.am (ELIX_SOURCES): Rename to...
(ELIX_2_SOURCES): ...this.
(ELIX_4_SOURCES): New category, for memmem.
(lib_a_SOURCES, libstring_la_SOURCES): Build new file.
(CHEWOUT_FILES): Build documentation for memmem.
* libc/string/strings.tex: Include new docs.
Diffstat (limited to 'newlib/libc/string/Makefile.am')
-rw-r--r-- | newlib/libc/string/Makefile.am | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/newlib/libc/string/Makefile.am b/newlib/libc/string/Makefile.am index 65200cf22..e4ad1d13f 100644 --- a/newlib/libc/string/Makefile.am +++ b/newlib/libc/string/Makefile.am @@ -72,9 +72,9 @@ GENERAL_SOURCES = \ wmemset.c if ELIX_LEVEL_1 -ELIX_SOURCES = +ELIX_2_SOURCES = else -ELIX_SOURCES = \ +ELIX_2_SOURCES = \ bcmp.c \ memccpy.c \ mempcpy.c \ @@ -87,15 +87,30 @@ ELIX_SOURCES = \ wcpncpy.c \ endif +if ELIX_LEVEL_1 +ELIX_4_SOURCES = +else +if ELIX_LEVEL_2 +ELIX_4_SOURCES = +else +if ELIX_LEVEL_3 +ELIX_4_SOURCES = +else +ELIX_4_SOURCES = \ + memmem.c +endif !ELIX_LEVEL_3 +endif !ELIX_LEVEL_2 +endif !ELIX_LEVEL_1 + libstring_la_LDFLAGS = -Xcompiler -nostdlib if USE_LIBTOOL noinst_LTLIBRARIES = libstring.la -libstring_la_SOURCES = $(GENERAL_SOURCES) $(ELIX_SOURCES) +libstring_la_SOURCES = $(GENERAL_SOURCES) $(ELIX_2_SOURCES) $(ELIX_4_SOURCES) noinst_DATA = objectlist.awk.in else noinst_LIBRARIES = lib.a -lib_a_SOURCES = $(GENERAL_SOURCES) $(ELIX_SOURCES) +lib_a_SOURCES = $(GENERAL_SOURCES) $(ELIX_2_SOURCES) $(ELIX_4_SOURCES) lib_a_CFLAGS = $(AM_CFLAGS) noinst_DATA = endif # USE_LIBTOOL @@ -117,7 +132,8 @@ wcslcat.def wcslcpy.def wcslen.def wcsncat.def \ wcsncmp.def wcsncpy.def wcsnlen.def wcspbrk.def \ wcsrchr.def wcsspn.def wcsstr.def \ wcswidth.def wcsxfrm.def wcwidth.def wmemchr.def \ -wmemcmp.def wmemcpy.def wmemmove.def wmemset.def +wmemcmp.def wmemcpy.def wmemmove.def wmemset.def \ +memmem.def SUFFIXES = .def |