]> git.saurik.com Git - apple/libc.git/blob - locale/FreeBSD/wctrans.c.patch
Libc-498.tar.gz
[apple/libc.git] / locale / FreeBSD / wctrans.c.patch
1 --- wctrans.c.orig 2004-11-25 11:38:20.000000000 -0800
2 +++ wctrans.c 2005-02-19 14:30:32.000000000 -0800
3 @@ -27,6 +27,8 @@
4 #include <sys/cdefs.h>
5 __FBSDID("$FreeBSD: src/lib/libc/locale/wctrans.c,v 1.3 2003/11/01 08:20:58 tjr Exp $");
6
7 +#include "xlocale_private.h"
8 +
9 #include <errno.h>
10 #include <string.h>
11 #include <wctype.h>
12 @@ -38,15 +40,16 @@
13 };
14
15 wint_t
16 -towctrans(wint_t wc, wctrans_t desc)
17 +towctrans_l(wint_t wc, wctrans_t desc, locale_t loc)
18 {
19
20 + NORMALIZE_LOCALE(loc);
21 switch (desc) {
22 case _WCT_TOLOWER:
23 - wc = towlower(wc);
24 + wc = towlower_l(wc, loc);
25 break;
26 case _WCT_TOUPPER:
27 - wc = towupper(wc);
28 + wc = towupper_l(wc, loc);
29 break;
30 case _WCT_ERROR:
31 default:
32 @@ -57,6 +60,12 @@
33 return (wc);
34 }
35
36 +wint_t
37 +towctrans(wint_t wc, wctrans_t desc)
38 +{
39 + return towctrans_l(wc, desc, __current_locale());
40 +}
41 +
42 wctrans_t
43 wctrans(const char *charclass)
44 {
45 @@ -78,3 +87,14 @@
46 errno = EINVAL;
47 return (ccls[i].trans);
48 }
49 +
50 +/*
51 + * The extended locale version just calls the regular version. If there
52 + * is ever support for arbitrary per-locale translations, this need to
53 + * be modified.
54 + */
55 +wctrans_t
56 +wctrans_l(const char *charclass, locale_t loc)
57 +{
58 + return wctrans(charclass);
59 +}