]> git.saurik.com Git - apple/libc.git/blame_incremental - locale/FreeBSD/mbrtowc.c.patch
Libc-498.tar.gz
[apple/libc.git] / locale / FreeBSD / mbrtowc.c.patch
... / ...
CommitLineData
1--- mbrtowc.c.orig 2004-11-25 11:38:18.000000000 -0800
2+++ mbrtowc.c 2005-02-18 18:21:18.000000000 -0800
3@@ -27,16 +27,24 @@
4 #include <sys/cdefs.h>
5 __FBSDID("$FreeBSD: src/lib/libc/locale/mbrtowc.c,v 1.7 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+mbrtowc_l(wchar_t * __restrict pwc, const char * __restrict s,
14+ size_t n, mbstate_t * __restrict ps, locale_t loc)
15+{
16+ NORMALIZE_LOCALE(loc);
17+ if (ps == NULL)
18+ ps = &loc->__mbs_mbrtowc;
19+ return (loc->__lc_ctype->__mbrtowc(pwc, s, n, ps, loc));
20+}
21+
22+size_t
23 mbrtowc(wchar_t * __restrict pwc, const char * __restrict s,
24 size_t n, mbstate_t * __restrict ps)
25 {
26- static mbstate_t mbs;
27-
28- if (ps == NULL)
29- ps = &mbs;
30- return (__mbrtowc(pwc, s, n, ps));
31+ return mbrtowc_l(pwc, s, n, ps, __current_locale());
32 }