]> git.saurik.com Git - apple/libc.git/blob - string/FreeBSD/wcsncasecmp.c.patch
d1d04e655c784a99827f15e76c672c9c2cef26ec
[apple/libc.git] / string / FreeBSD / wcsncasecmp.c.patch
1 --- wcsncasecmp.c.orig 2009-12-16 12:51:30.000000000 -0800
2 +++ wcsncasecmp.c 2009-12-16 13:02:55.000000000 -0800
3 @@ -27,19 +27,21 @@
4 #include <sys/cdefs.h>
5 __FBSDID("$FreeBSD: src/lib/libc/string/wcsncasecmp.c,v 1.1 2009/02/28 06:00:58 das Exp $");
6
7 +#include "xlocale_private.h"
8 +
9 #include <wchar.h>
10 #include <wctype.h>
11
12 int
13 -wcsncasecmp(const wchar_t *s1, const wchar_t *s2, size_t n)
14 +wcsncasecmp_l(const wchar_t *s1, const wchar_t *s2, size_t n, locale_t loc)
15 {
16 wchar_t c1, c2;
17
18 if (n == 0)
19 return (0);
20 for (; *s1; s1++, s2++) {
21 - c1 = towlower(*s1);
22 - c2 = towlower(*s2);
23 + c1 = towlower_l(*s1, loc);
24 + c2 = towlower_l(*s2, loc);
25 if (c1 != c2)
26 return ((int)c1 - c2);
27 if (--n == 0)
28 @@ -47,3 +49,9 @@ wcsncasecmp(const wchar_t *s1, const wch
29 }
30 return (-*s2);
31 }
32 +
33 +int
34 +wcsncasecmp(const wchar_t *s1, const wchar_t *s2, size_t n) {
35 + return wcsncasecmp_l(s1, s2, n, __current_locale());
36 +}
37 +