]> git.saurik.com Git - apple/libc.git/blob - locale/FreeBSD/wctype.c.patch
Libc-763.11.tar.gz
[apple/libc.git] / locale / FreeBSD / wctype.c.patch
1 --- wctype.c.bsdnew 2009-11-09 15:05:25.000000000 -0800
2 +++ wctype.c 2009-11-09 17:53:01.000000000 -0800
3 @@ -27,21 +27,17 @@
4 #include <sys/cdefs.h>
5 __FBSDID("$FreeBSD: src/lib/libc/locale/wctype.c,v 1.4 2008/03/17 18:22:23 antoine Exp $");
6
7 +#include "xlocale_private.h"
8 +
9 #include <ctype.h>
10 #include <string.h>
11 #include <wctype.h>
12 -
13 -#undef iswctype
14 -int
15 -iswctype(wint_t wc, wctype_t charclass)
16 -{
17 -
18 - return (__istype(wc, charclass));
19 -}
20 +#include <limits.h>
21
22 wctype_t
23 -wctype(const char *property)
24 +wctype_l(const char *property, locale_t loc)
25 {
26 + _RuneLocale *rl;
27 static const struct {
28 const char *name;
29 wctype_t mask;
30 @@ -70,5 +66,23 @@ wctype(const char *property)
31 while (props[i].name != NULL && strcmp(props[i].name, property) != 0)
32 i++;
33
34 - return (props[i].mask);
35 + if (props[i].mask)
36 + return (props[i].mask);
37 +
38 + NORMALIZE_LOCALE(loc);
39 + rl = &loc->__lc_ctype->_CurrentRuneLocale;
40 + if ((i = rl->__ncharclasses) > 0) {
41 + _RuneCharClass *rp;
42 + for (rp = rl->__charclasses; i-- > 0; rp++) {
43 + if (strncmp(rp->__name, property, CHARCLASS_NAME_MAX) == 0)
44 + return (rp->__mask);
45 + }
46 + }
47 + return 0;
48 +}
49 +
50 +wctype_t
51 +wctype(const char *property)
52 +{
53 + return wctype_l(property, __current_locale());
54 }