]> git.saurik.com Git - apple/libc.git/blob - locale/FreeBSD/wcrtomb.c.patch
365a10f05192ea5eb6c38c681392930d10548dd3
[apple/libc.git] / locale / FreeBSD / wcrtomb.c.patch
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 }