]> git.saurik.com Git - apple/libc.git/blame_incremental - locale/FreeBSD/wcsrtombs.c.patch
Libc-763.13.tar.gz
[apple/libc.git] / locale / FreeBSD / wcsrtombs.c.patch
... / ...
CommitLineData
1--- wcsrtombs.c.orig 2009-11-09 15:05:25.000000000 -0800
2+++ wcsrtombs.c 2009-11-09 15:05:26.000000000 -0800
3@@ -27,6 +27,8 @@
4 #include <sys/cdefs.h>
5 __FBSDID("$FreeBSD: src/lib/libc/locale/wcsrtombs.c,v 1.6 2004/07/21 10:54:57 tjr Exp $");
6
7+#include "xlocale_private.h"
8+
9 #include <limits.h>
10 #include <stdlib.h>
11 #include <string.h>
12@@ -34,12 +36,18 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/
13 #include "mblocal.h"
14
15 size_t
16+wcsrtombs_l(char * __restrict dst, const wchar_t ** __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_wcsrtombs;
22+ return (loc->__lc_ctype->__wcsnrtombs(dst, src, SIZE_T_MAX, len, ps, loc));
23+}
24+
25+size_t
26 wcsrtombs(char * __restrict dst, const wchar_t ** __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 (__wcsnrtombs(dst, src, SIZE_T_MAX, len, ps));
34+ return wcsrtombs_l(dst, src, len, ps, __current_locale());
35 }