Re: strcasestr [was: strstr speedup]

2008-01-19 Thread Bruno Haible
Eric Blake wrote: > Here's what I'm committing for strcasestr, including a strcasestr-simple > module, and the first attempt at a glibc function extensions chapter. Thanks for this! I've now extended the glibc function extensions chapter. > --- /dev/null > +++ b/doc/functions/strcasestr.texi > @@

strcasestr [was: strstr speedup]

2008-01-14 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Bruno Haible on 1/11/2008 4:21 AM: | Eric Blake wrote: |> | should I go ahead and prepare a patch for strcasestr, c-strcasestr, and |> | memcasecmp to utilize str-two-way.h? | | Yes for strcasestr and c-strcasestr. Here's what I'm commit

Re: strstr speedup

2008-01-12 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Bruno Haible on 1/12/2008 8:55 AM: |> so we can directly use tolower() here without expanding the |> argument multiple times? | | I would not put side effects into the argument of tolower(): Some platforms | may expand it into a macro whi

Re: strstr speedup

2008-01-12 Thread Bruno Haible
Eric Blake wrote: > Are there still broken platforms out there where tolower() disobeys > the POSIX requirement that it leave the argument unchanged if it was not > already an upper-case letter? This portability problem is very old. I don't think it's still relevant, but I don't know for sure. >

Re: strstr speedup

2008-01-12 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Eric Blake on 1/10/2008 10:25 PM: | How's this for strcasestr? | #define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch)) | | -/* Knuth-Morris-Pratt algorithm. */ | +/* Two-Way algorithm. */ | +#define RETURN_TYPE char * | +#define AV

Re: strstr speedup

2008-01-11 Thread Bruno Haible
Eric Blake wrote: > --- a/doc/functions/strstr.texi > +++ b/doc/functions/strstr.texi > @@ -4,10 +4,14 @@ >   >  POSIX specification: @url{http://www.opengroup.org/susv3xsh/strstr.html} >   > -Gnulib module: --- > +Gnulib module: strstr >   >  Portability problems fixed by Gnulib: > [EMAIL PROTECTE

Re: strstr speedup

2008-01-11 Thread Bruno Haible
Eric Blake wrote: > | should I go ahead and prepare a patch for strcasestr, c-strcasestr, and > | memcasecmp to utilize str-two-way.h? Yes for strcasestr and c-strcasestr. > How's this for strcasestr? Glibc's strcasestr is quadratic (no surprise > there, given our track record); cygwin 1.5.x doe

Re: strstr speedup

2008-01-10 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Eric Blake on 1/10/2008 8:33 PM: | should I go ahead and prepare a patch for strcasestr, c-strcasestr, and | memcasecmp to utilize str-two-way.h? How's this for strcasestr? Glibc's strcasestr is quadratic (no surprise there, given our t

Re: strstr speedup

2008-01-10 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Bruno Haible on 1/10/2008 7:53 PM: | Eric Blake wrote: |> +# Prerequisites of lib/memmem.c. |> +AC_DEFUN([gl_PREREQ_MEMMEM], [:]) |> +]) | | These lines are not needed in m4/strstr.m4. Oops; copy-n-pasto. Obvious fix coming up soon. -

Re: strstr speedup

2008-01-10 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Bruno Haible on 1/10/2008 8:04 PM: | | I dislike strcasestr because it _appears_ to be locale dependent if you test | it with some old locales - but it does not work with the majority of locales | in use today. The only reason to support

Re: strstr speedup

2008-01-10 Thread Bruno Haible
Eric Blake wrote: > I'm committing this series to add a strstr module similar to memmem > ... > I'm also thinking that we do not need the c_strstr module - aside from its > comments on when it is safe to use a bytewise search even in a multibyte > locale, it behaves no differently than the POSIX

Re: strstr speedup

2008-01-10 Thread Bruno Haible
Eric Blake wrote: > +# Prerequisites of lib/memmem.c. > +AC_DEFUN([gl_PREREQ_MEMMEM], [:]) > +]) These lines are not needed in m4/strstr.m4. Bruno