strncasecmp bugfix and improvements

Wizards' Guild wizardsguild@earthlink.net
Wed Apr 22 04:05:00 GMT 2009


Jeff,

Here is the patch I've owed for some days... the recent topic jogged my memory.

On Apr 6 21:14, Wizards' Guild wrote:
> Thanks! I hadn't expected such a quick response! :)
> 
> Here are the other routines changed similarly. The first gets a similar 
> performance improvement; the others are changed only to avoid passing 
> negative values to toupper/tolower. I have _ansi'fied this time.
> 
> The docs for both strcasecmp and strncasecmp say "after both are converted 
> to uppercase" - this is wrong, because both are converted to lowercase.

Note that strncasecmp.c is also changed to correct the minor documentation error.

        * libc/string/strcasecmp.c: Optimized rewrite.
        * libc/string/strlwr.c: Avoid passing signed char to tolower.
        * libc/string/strupr.c: Avoid passing signed char to tolower.

---
Mike Burgess
Avanex Corporation
607-562-7169
-------------- next part --------------
A non-text attachment was scrubbed...
Name: string.patch
Type: application/octet-stream
Size: 3604 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/newlib/attachments/20090422/bd037036/attachment.obj>


More information about the Newlib mailing list