xref: /haiku/src/system/libroot/posix/wchar/wcscasecmp.c (revision 83b1a68c52ba3e0e8796282759f694b7fdddf06d)
1 /*
2 ** Copyright 2011, Oliver Tappe, zooey@hirschkaefer.de. All rights reserved.
3 ** Distributed under the terms of the Haiku License.
4 */
5 
6 #include <wctype.h>
7 
8 #include <wchar_private.h>
9 
10 
11 int
12 __wcscasecmp(const wchar_t* wcs1, const wchar_t* wcs2)
13 {
14 	int cmp;
15 
16 	for (;;) {
17 		cmp = towlower(*wcs1) - towlower(*wcs2++);
18 			/* note: won't overflow, since our wchar_t is guaranteed to never
19 			   have the highest bit set */
20 
21 		if (cmp != 0 || *wcs1++ == L'\0')
22 			break;
23 	}
24 
25 	return cmp;
26 }
27 
28 
29 B_DEFINE_WEAK_ALIAS(__wcscasecmp, wcscasecmp);
30