]> git.saurik.com Git - apple/libc.git/blame - locale/FreeBSD/wcrtomb.c.patch
Libc-594.9.5.tar.gz
[apple/libc.git] / locale / FreeBSD / wcrtomb.c.patch
CommitLineData
3d9156a7
A
1--- wcrtomb.c.orig 2004-11-25 11:38:20.000000000 -0800
2+++ wcrtomb.c 2005-02-18 18:30:14.000000000 -0800
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 }