libroot_debug: Merge guarded heap into libroot_debug.
[haiku.git] / src / system / libroot / posix / wchar / wcsncasecmp.c
blob762f9a8231453a13cb1d5f9d0c88e41fb31238a6
1 /*
2 ** Copyright 2011, Oliver Tappe, zooey@hirschkaefer.de. All rights reserved.
3 ** Distributed under the terms of the Haiku License.
4 */
6 #include <wctype.h>
8 #include <wchar_private.h>
11 int
12 __wcsncasecmp(const wchar_t* wcs1, const wchar_t* wcs2, size_t count)
14 int cmp = 0;
16 while (count-- > 0) {
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 */
21 if (cmp != 0 || *wcs1++ == L'\0')
22 break;
25 return cmp;
29 B_DEFINE_WEAK_ALIAS(__wcsncasecmp, wcsncasecmp);