]> git.saurik.com Git - apple/libc.git/blame - locale/FreeBSD/mbstowcs.c.patch
Libc-763.11.tar.gz
[apple/libc.git] / locale / FreeBSD / mbstowcs.c.patch
CommitLineData
1f2f436a
A
1--- mbstowcs.c.bsdnew 2009-11-09 15:05:25.000000000 -0800
2+++ mbstowcs.c 2009-11-09 16:20:59.000000000 -0800
3@@ -27,19 +27,29 @@
3d9156a7 4 #include <sys/cdefs.h>
1f2f436a 5 __FBSDID("$FreeBSD: src/lib/libc/locale/mbstowcs.c,v 1.12 2009/01/15 18:53:52 rdivacky Exp $");
3d9156a7
A
6
7+#include "xlocale_private.h"
8+
9 #include <limits.h>
10 #include <stdlib.h>
11 #include <wchar.h>
12 #include "mblocal.h"
13
14 size_t
15-mbstowcs(wchar_t * __restrict pwcs, const char * __restrict s, size_t n)
16+mbstowcs_l(wchar_t * __restrict pwcs, const char * __restrict s, size_t n,
17+ locale_t loc)
18 {
19 static const mbstate_t initial;
20 mbstate_t mbs;
1f2f436a 21 const char *sp;
3d9156a7
A
22
23+ NORMALIZE_LOCALE(loc);
24 mbs = initial;
1f2f436a
A
25 sp = s;
26- return (__mbsnrtowcs(pwcs, &sp, SIZE_T_MAX, n, &mbs));
27+ return (loc->__lc_ctype->__mbsnrtowcs(pwcs, &sp, SIZE_T_MAX, n, &mbs, loc));
3d9156a7
A
28+}
29+
30+size_t
31+mbstowcs(wchar_t * __restrict pwcs, const char * __restrict s, size_t n)
32+{
33+ return mbstowcs_l(pwcs, s, n, __current_locale());
34 }