mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 02:27:39 -04:00
strcasecmp: Optimize size and speed
Applies changes similar to strncasecmp in 64c0cfb0
.
Change-Id: I5f80b0031dd12c58d982578f5c5224c7f59cd915
This commit is contained in:
parent
3e92a11618
commit
e08b8fcc74
1 changed files with 7 additions and 5 deletions
|
@ -5,12 +5,14 @@
|
||||||
#ifndef strcasecmp
|
#ifndef strcasecmp
|
||||||
int strcasecmp(const char *s1, const char *s2)
|
int strcasecmp(const char *s1, const char *s2)
|
||||||
{
|
{
|
||||||
while (*s1 != '\0' && tolower(*s1) == tolower(*s2)) {
|
int d, c1, c2;
|
||||||
s1++;
|
do
|
||||||
s2++;
|
{
|
||||||
|
c1 = tolower(*s1++);
|
||||||
|
c2 = tolower(*s2++);
|
||||||
}
|
}
|
||||||
|
while ((d = c1 - c2) == 0 && c1 && c2);
|
||||||
return tolower(*(unsigned char *) s1) - tolower(*(unsigned char *) s2);
|
return d;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue