]> git.saurik.com Git - apple/libc.git/blob - locale/FreeBSD/mbsrtowcs.c.patch
f1cde86a3ac6e815e07d25d2de9dcb81b98de301
[apple/libc.git] / locale / FreeBSD / mbsrtowcs.c.patch
1 --- mbsrtowcs.c.orig 2004-11-25 11:38:18.000000000 -0800
2 +++ mbsrtowcs.c 2005-02-18 18:28:00.000000000 -0800
3 @@ -27,6 +27,8 @@
4 #include <sys/cdefs.h>
5 __FBSDID("$FreeBSD: src/lib/libc/locale/mbsrtowcs.c,v 1.6 2004/07/21 10:54:57 tjr Exp $");
6
7 +#include "xlocale_private.h"
8 +
9 #include <errno.h>
10 #include <limits.h>
11 #include <stdlib.h>
12 @@ -34,12 +36,18 @@
13 #include "mblocal.h"
14
15 size_t
16 +mbsrtowcs_l(wchar_t * __restrict dst, const char ** __restrict src, size_t len,
17 + mbstate_t * __restrict ps, locale_t loc)
18 +{
19 + NORMALIZE_LOCALE(loc);
20 + if (ps == NULL)
21 + ps = &loc->__mbs_mbsrtowcs;
22 + return (loc->__lc_ctype->__mbsnrtowcs(dst, src, SIZE_T_MAX, len, ps, loc));
23 +}
24 +
25 +size_t
26 mbsrtowcs(wchar_t * __restrict dst, const char ** __restrict src, size_t len,
27 mbstate_t * __restrict ps)
28 {
29 - static mbstate_t mbs;
30 -
31 - if (ps == NULL)
32 - ps = &mbs;
33 - return (__mbsnrtowcs(dst, src, SIZE_T_MAX, len, ps));
34 + return mbsrtowcs_l(dst, src, len, ps, __current_locale());
35 }