]> git.saurik.com Git - apple/libc.git/blob - locale/FreeBSD/nextwctype.c.patch
Libc-391.tar.gz
[apple/libc.git] / locale / FreeBSD / nextwctype.c.patch
1 --- nextwctype.c.orig 2004-11-25 11:38:19.000000000 -0800
2 +++ nextwctype.c 2005-02-19 03:44:49.000000000 -0800
3 @@ -27,28 +27,32 @@
4 #include <sys/cdefs.h>
5 __FBSDID("$FreeBSD: src/lib/libc/locale/nextwctype.c,v 1.1 2004/07/08 06:43:37 tjr Exp $");
6
7 +#include "xlocale_private.h"
8 +
9 #include <runetype.h>
10 #include <wchar.h>
11 #include <wctype.h>
12
13 wint_t
14 -nextwctype(wint_t wc, wctype_t wct)
15 +nextwctype_l(wint_t wc, wctype_t wct, locale_t loc)
16 {
17 size_t lim;
18 - _RuneRange *rr = &_CurrentRuneLocale->__runetype_ext;
19 + _RuneRange *rr;
20 _RuneEntry *base, *re;
21 int noinc;
22 + _RuneLocale *rl = &loc->__lc_ctype->_CurrentRuneLocale;
23
24 noinc = 0;
25 if (wc < _CACHED_RUNES) {
26 wc++;
27 while (wc < _CACHED_RUNES) {
28 - if (_CurrentRuneLocale->__runetype[wc] & wct)
29 + if (rl->__runetype[wc] & wct)
30 return (wc);
31 wc++;
32 }
33 wc--;
34 }
35 + rr = &rl->__runetype_ext;
36 if (rr->__ranges != NULL && wc < rr->__ranges[0].__min) {
37 wc = rr->__ranges[0].__min;
38 noinc = 1;
39 @@ -88,3 +92,9 @@
40 }
41 return (-1);
42 }
43 +
44 +wint_t
45 +nextwctype(wint_t wc, wctype_t wct)
46 +{
47 + return nextwctype_l(wc, wct, __current_locale());
48 +}