]> git.saurik.com Git - apple/libc.git/blame - locale/FreeBSD/wcstombs.c.patch
Libc-498.tar.gz
[apple/libc.git] / locale / FreeBSD / wcstombs.c.patch
CommitLineData
3d9156a7
A
1--- wcstombs.c.orig Thu Nov 25 11:38:20 2004
2+++ wcstombs.c Fri Feb 18 17:17:37 2005
3@@ -27,17 +27,27 @@
4 #include <sys/cdefs.h>
5 __FBSDID("$FreeBSD: src/lib/libc/locale/wcstombs.c,v 1.10 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 <wchar.h>
12 #include "mblocal.h"
13
14 size_t
15-wcstombs(char * __restrict s, const wchar_t * __restrict pwcs, size_t n)
16+wcstombs_l(char * __restrict s, const wchar_t * __restrict pwcs, size_t n,
17+ locale_t loc)
18 {
19 static const mbstate_t initial;
20 mbstate_t mbs;
21
22+ NORMALIZE_LOCALE(loc);
23 mbs = initial;
24- return (__wcsnrtombs(s, &pwcs, SIZE_T_MAX, n, &mbs));
25+ return (loc->__lc_ctype->__wcsnrtombs(s, &pwcs, SIZE_T_MAX, n, &mbs, loc));
26+}
27+
28+size_t
29+wcstombs(char * __restrict s, const wchar_t * __restrict pwcs, size_t n)
30+{
31+ return wcstombs_l(s, pwcs, n, __current_locale());
32 }