]> git.saurik.com Git - apple/libc.git/blame - locale/FreeBSD/wctob.c.patch
Libc-763.11.tar.gz
[apple/libc.git] / locale / FreeBSD / wctob.c.patch
CommitLineData
1f2f436a
A
1--- wctob.c.orig 2009-11-09 15:05:25.000000000 -0800
2+++ wctob.c 2009-11-09 15:05:26.000000000 -0800
3d9156a7
A
3@@ -27,19 +27,28 @@
4 #include <sys/cdefs.h>
5 __FBSDID("$FreeBSD: src/lib/libc/locale/wctob.c,v 1.4 2004/05/12 14:26:54 tjr Exp $");
6
7+#include "xlocale_private.h"
8+
9 #include <limits.h>
10 #include <stdio.h>
11 #include <wchar.h>
12 #include "mblocal.h"
13
14 int
15-wctob(wint_t c)
16+wctob_l(wint_t c, locale_t loc)
17 {
18 static const mbstate_t initial;
19 mbstate_t mbs = initial;
20 char buf[MB_LEN_MAX];
21
22- if (c == WEOF || __wcrtomb(buf, c, &mbs) != 1)
23+ NORMALIZE_LOCALE(loc);
24+ if (c == WEOF || loc->__lc_ctype->__wcrtomb(buf, c, &mbs, loc) != 1)
25 return (EOF);
26 return ((unsigned char)*buf);
27 }
28+
29+int
30+wctob(wint_t c)
31+{
32+ return wctob_l(c, __current_locale());
33+}