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 __wcsncasecmp(const wchar_t* wcs1, const wchar_t* wcs2, size_t count) 13 { 14 int cmp = 0; 15 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 */ 20 21 if (cmp != 0 || *wcs1++ == L'\0') 22 break; 23 } 24 25 return cmp; 26 } 27 28 29 B_DEFINE_WEAK_ALIAS(__wcsncasecmp, wcsncasecmp); 30