Date: Thu, 14 Feb 2013 10:23:49 -0500 From: Rich Felker <dalias@...ifal.cx> To: musl@...ts.openwall.com Subject: Re: strcasestr.c On Thu, Feb 14, 2013 at 09:59:56AM -0500, Todd C. Miller wrote: > When investigating using the musl strstr.c ofr OpenBSD I noticed > that musl only has a stub for strcasestr() that calls strstr(). I > was curious whether the twoway algorithm could be adapted to do a > case-insensitive search. It turned out to be pretty trivial to > just add calls to tolower() in the right places, making sure to > avoid sign extension. > > The changes are mostly mechanical. You might wish to inline > _strcasechr() though the compiler will probably do that for you. Unfortunately, as far as I can tell making this correct is nontrivial; your version only works for ascii, not the rest of ucs. I don't see any easy way to adapt 2way to the case where matching classes contain characters of different lengths... Rich
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.