From 40617efc8b9309006af1f0c72425fc4a404f40d4 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Sat, 12 Jan 2008 04:25:55 +0000 Subject: 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. --- newlib/libc/string/strings.tex | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'newlib/libc/string/strings.tex') diff --git a/newlib/libc/string/strings.tex b/newlib/libc/string/strings.tex index 5ba6e0fe5..6750f3eb0 100644 --- a/newlib/libc/string/strings.tex +++ b/newlib/libc/string/strings.tex @@ -14,6 +14,7 @@ managing areas of memory. The corresponding declarations are in * memchr:: Find character in memory * memcmp:: Compare two memory areas * memcpy:: Copy memory regions +* memmem:: Find memory segment * memmove:: Move possibly overlapping memory * mempcpy:: Copy memory regions and locate end * memset:: Set an area of memory @@ -71,6 +72,9 @@ managing areas of memory. The corresponding declarations are in @page @include string/memcpy.def +@page +@include string/memmem.def + @page @include string/memmove.def -- cgit v1.2.3