1
0
Fork 0
forked from len0rd/rockbox

strcasecmp: Optimize size and speed

Applies changes similar to strncasecmp in 64c0cfb0.

Change-Id: I5f80b0031dd12c58d982578f5c5224c7f59cd915
This commit is contained in:
Roman Artiukhin 2025-05-10 16:12:31 +03:00 committed by Solomon Peachy
parent 3e92a11618
commit e08b8fcc74

View file

@ -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