Eric Blake <[EMAIL PROTECTED]> writes: > Several issues with memmem: > > - It uses memcmp without depending on the memcmp module, making it needlessly > fail on some older platforms. But memcmp is currently licensed LGPL; is it > okay with everyone that this patch relicenses it as LGPLv2+? (Or are such > platforms so obsolete that we can delete the memcmp module?)
I haven't run into any such problems, and we've built gnutls (which was the original reason for memmem, IIRC) on a couple of embedded platforms with otherwise strange environments. > - test-memmem.c was flat-out broken (calling memmem with 3 instead of 4 > arguments). The reason it was never compiled was the lack of a memmem-tests > module. The test was written for an earlier version of memmem() that were used in gnutls. When memmem was moved into gnulib, we aligned it with glibc and used 4 arguments. > - There are platform-specific bugs in existing memmem implementations. > Cygwin, > for example, returns NULL instead of haystack for memmem(haystack,len,"",0). > How best do I document platform bugs in non-standardized functions? doc/gnulib.texi? > Here's a patch for these issues; it breaks sync with glibc (and hence loses > the > K&R declaration). Tested on cygwin (where memmem is broken) and mingw (where > memmem is missing). Okay to apply? Fine by me. I'll test it if you commit it. Thanks, /Simon