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