xref: /haiku/src/system/libroot/posix/wchar/wcscmp.c (revision d3ff06683af390a4c2e83b69177e0a2eb76679bc)
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 <wchar_private.h>
7 
8 
9 int
10 __wcscmp(const wchar_t* wcs1, const wchar_t* wcs2)
11 {
12 	int cmp;
13 
14 	for (;;) {
15 		cmp = *wcs1 - *wcs2++;
16 			/* note: won't overflow, since our wchar_t is guaranteed to never
17 			   have the highest bit set */
18 
19 		if (cmp != 0 || *wcs1++ == L'\0')
20 			break;
21 	}
22 
23 	return cmp;
24 }
25 
26 
27 B_DEFINE_WEAK_ALIAS(__wcscmp, wcscmp);
28