]> git.saurik.com Git - apple/libc.git/blame - locale/FreeBSD/wcrtomb.c.patch
Libc-763.11.tar.gz
[apple/libc.git] / locale / FreeBSD / wcrtomb.c.patch
CommitLineData
1f2f436a
A
1--- wcrtomb.c.orig 2009-11-09 15:05:25.000000000 -0800
2+++ wcrtomb.c 2009-11-09 15:05:26.000000000 -0800
3d9156a7
A
3@@ -27,15 +27,23 @@
4 #include <sys/cdefs.h>
5 __FBSDID("$FreeBSD: src/lib/libc/locale/wcrtomb.c,v 1.8 2004/05/12 14:09:04 tjr Exp $");
6
7+#include "xlocale_private.h"
8+
9 #include <wchar.h>
10 #include "mblocal.h"
11
12 size_t
13-wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps)
14+wcrtomb_l(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps,
15+ locale_t loc)
16 {
17- static mbstate_t mbs;
18-
19+ NORMALIZE_LOCALE(loc);
20 if (ps == NULL)
21- ps = &mbs;
22- return (__wcrtomb(s, wc, ps));
23+ ps = &loc->__mbs_wcrtomb;
24+ return (loc->__lc_ctype->__wcrtomb(s, wc, ps, loc));
25+}
26+
27+size_t
28+wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps)
29+{
30+ return wcrtomb_l(s, wc, ps, __current_locale());
31 }