Re: Fix trim2 uninitialized GCC warning

2023-04-02 Thread Bruno Haible
Hello Georg, > However, to eliminate the warning, the code also can be simplified like this: > > ``` > diff --git a/lib/trim.c b/lib/trim.c > index 162c43e1de..bfd743cf0f 100644 > --- a/lib/trim.c > +++ b/lib/trim.c > @@ -30,12 +30,6 @@ > #include "mbiter.h" > #include "xalloc.h" > > -/* Use

Fix trim2 uninitialized GCC warning

2023-04-02 Thread Georg Sauthoff
Hello, on Fedora Rawhide, gnulib compilation yields the following warning: gcc -DLOCALEDIR=\"/usr/share/locale\" -DHAVE_CONFIG_H -I. -Ilib -I./lib -Isrc -I./src -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-

unistr/u{16,32}-strstr: Use two-way algorithm

2023-04-02 Thread Bruno Haible
Now that the wcsstr function in gnulib is O(n), thanks to the two-way algorithm, it's time to apply the same optimization to u16_strstr and u32_strstr. Both so far used the Knuth-Morris-Pratt algorithm, that is O(n) as well in regular situations but falls back to O(n²) if there is out-of-memory con

unistr/u*strstr tests: Add more tests

2023-04-02 Thread Bruno Haible
In and I added more tests to tests/test-strstr.c. With this patch, I'm adding the same tests also to the libunistring *strstr modules. 2023-04-02 Bruno Hai