tweaks: don't optimize for a special case -- it is far too seldom
parent
85844ee6ef
commit
370406bb41
10
src/chars.c
10
src/chars.c
|
@ -514,7 +514,6 @@ int mbstrncasecmp(const char *s1, const char *s2, size_t n)
|
||||||
|
|
||||||
while (*s1 != '\0' && *s2 != '\0' && n > 0) {
|
while (*s1 != '\0' && *s2 != '\0' && n > 0) {
|
||||||
bool bad1 = FALSE, bad2 = FALSE;
|
bool bad1 = FALSE, bad2 = FALSE;
|
||||||
int difference;
|
|
||||||
|
|
||||||
if (mbtowc(&wc1, s1, MB_CUR_MAX) < 0) {
|
if (mbtowc(&wc1, s1, MB_CUR_MAX) < 0) {
|
||||||
mbtowc_reset();
|
mbtowc_reset();
|
||||||
|
@ -532,15 +531,12 @@ int mbstrncasecmp(const char *s1, const char *s2, size_t n)
|
||||||
|
|
||||||
if (bad1 != bad2)
|
if (bad1 != bad2)
|
||||||
return (bad1 ? 1 : -1);
|
return (bad1 ? 1 : -1);
|
||||||
|
} else {
|
||||||
s1++; s2++; n--;
|
int difference = towlower(wc1) - towlower(wc2);
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
difference = towlower(wc1) - towlower(wc2);
|
|
||||||
|
|
||||||
if (difference != 0)
|
if (difference != 0)
|
||||||
return difference;
|
return difference;
|
||||||
|
}
|
||||||
|
|
||||||
s1 += move_mbright(s1, 0);
|
s1 += move_mbright(s1, 0);
|
||||||
s2 += move_mbright(s2, 0);
|
s2 += move_mbright(s2, 0);
|
||||||
|
|
Loading…
Reference in New Issue