Commit b305911c authored by Benno Schulenberg's avatar Benno Schulenberg
Browse files

chars: straighten out the flow of a loop, so it is easier to follow

No related merge requests found
Showing with 5 additions and 2 deletions
+5 -2
...@@ -512,8 +512,7 @@ int mbstrncasecmp(const char *s1, const char *s2, size_t n) ...@@ -512,8 +512,7 @@ int mbstrncasecmp(const char *s1, const char *s2, size_t n)
assert(s1 != NULL && s2 != NULL); assert(s1 != NULL && s2 != NULL);
for (; *s1 != '\0' && *s2 != '\0' && n > 0; while (*s1 != '\0' && *s2 != '\0' && n > 0) {
s1 += move_mbright(s1, 0), s2 += move_mbright(s2, 0), n--) {
bool bad1 = FALSE, bad2 = FALSE; bool bad1 = FALSE, bad2 = FALSE;
if (mbtowc(&wc1, s1, MB_CUR_MAX) < 0) { if (mbtowc(&wc1, s1, MB_CUR_MAX) < 0) {
...@@ -530,6 +529,10 @@ int mbstrncasecmp(const char *s1, const char *s2, size_t n) ...@@ -530,6 +529,10 @@ int mbstrncasecmp(const char *s1, const char *s2, size_t n)
if (bad1 != bad2 || towlower(wc1) != towlower(wc2)) if (bad1 != bad2 || towlower(wc1) != towlower(wc2))
break; break;
s1 += move_mbright(s1, 0);
s2 += move_mbright(s2, 0);
n--;
} }
return (n > 0) ? towlower(wc1) - towlower(wc2) : 0; return (n > 0) ? towlower(wc1) - towlower(wc2) : 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment