Make uN_strstr functions O(n) worst-case.
authorBruno Haible <bruno@clisp.org>
Fri, 21 Jan 2011 13:06:47 +0000 (14:06 +0100)
committerBruno Haible <bruno@clisp.org>
Fri, 21 Jan 2011 13:06:47 +0000 (14:06 +0100)
commit5df9ff919db13d7edeefd1d48ce942ba0d8cc0dc
tree3af1c1436d6e741e5ad417870010af913d91472a
parent1b1e945287b0e30a238102974f7a51f24def2a79
Make uN_strstr functions O(n) worst-case.

* lib/unistr/u-strstr.h (FUNC): In the 8-bit case, use strstr. In the
16-bit and 32-bit unit cases, use the unibyte algorithm from
lib/mbsstr.c.
* lib/unistr/u8-strstr.c: Include <string.h>.
(UNIT_IS_UINT8_T): New macro.
* lib/unistr/u16-strstr.c: Include malloca.h and str-kmp.h.
(U_STRLEN, U_STRNLEN): New macros.
* lib/unistr/u32-strstr.c: Include malloca.h and str-kmp.h.
(U_STRLEN, U_STRNLEN): New macros.
* modules/unistr/u8-strstr (Depends-on): Add strstr.
(configure.ac): Update required libunistring version.
* modules/unistr/u16-strstr (Files): Add lib/str-kmp.h.
(Depends-on): Add unistr/u16-strlen, unistr/u16-strnlen, stdbool,
malloca.
(configure.ac): Update required libunistring version.
* modules/unistr/u32-strstr (Files): Add lib/str-kmp.h.
(Depends-on): Add unistr/u32-strlen, unistr/u32-strnlen, stdbool,
malloca.
(configure.ac): Update required libunistring version.
ChangeLog
lib/unistr/u-strstr.h
lib/unistr/u16-strstr.c
lib/unistr/u32-strstr.c
lib/unistr/u8-strstr.c
modules/unistr/u16-strstr
modules/unistr/u32-strstr
modules/unistr/u8-strstr