aboutsummaryrefslogtreecommitdiff
path: root/newlib/libc/string/wcscasecmp.c
diff options
context:
space:
mode:
Diffstat (limited to 'newlib/libc/string/wcscasecmp.c')
-rw-r--r--newlib/libc/string/wcscasecmp.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/newlib/libc/string/wcscasecmp.c b/newlib/libc/string/wcscasecmp.c
index f9f169f..05f9561 100644
--- a/newlib/libc/string/wcscasecmp.c
+++ b/newlib/libc/string/wcscasecmp.c
@@ -46,11 +46,13 @@ _DEFUN (wcscasecmp, (s1, s2),
_CONST wchar_t *s1 _AND
_CONST wchar_t *s2)
{
- while (*s1 != '\0' && towlower(*s1) == towlower(*s2))
+ int d = 0;
+ for ( ; ; )
{
- s1++;
- s2++;
+ const int c1 = towlower (*s1++);
+ const int c2 = towlower (*s2++);
+ if (((d = c1 - c2) != 0) || (c2 == '\0'))
+ break;
}
-
- return towlower(*s1) - towlower(*s2);
+ return d;
}