From c1b7d9d93dc8e88693162c0d984a114371919fdd Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Sun, 24 Jul 2016 20:00:34 +0200 Subject: Implement per-locale string functions strcasecmp_l, strcoll_l, strncasecmp_l, strxfrm_l, wcscasecmp_l, wcscoll_l, wcstrncasecmp_l, wcstrxfrm_l, strftime_l. Add missing CHEWOUT_FILES from previous patch. TODO: strfmon_l. Signed-off by: Corinna Vinschen --- newlib/libc/string/wcscasecmp.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'newlib/libc/string/wcscasecmp.c') diff --git a/newlib/libc/string/wcscasecmp.c b/newlib/libc/string/wcscasecmp.c index f9f169f8b..05f95619d 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; } -- cgit v1.2.3