]>
Commit | Line | Data |
---|---|---|
3d9156a7 A |
1 | --- wctomb.c.orig 2004-11-25 11:38:20.000000000 -0800 |
2 | +++ wctomb.c 2005-02-18 18:40:43.000000000 -0800 | |
3 | @@ -27,23 +27,31 @@ | |
4 | #include <sys/cdefs.h> | |
5 | __FBSDID("$FreeBSD: src/lib/libc/locale/wctomb.c,v 1.8 2004/07/29 06:18:40 tjr Exp $"); | |
6 | ||
7 | +#include "xlocale_private.h" | |
8 | + | |
9 | #include <stdlib.h> | |
10 | #include <wchar.h> | |
11 | #include "mblocal.h" | |
12 | ||
13 | int | |
14 | -wctomb(char *s, wchar_t wchar) | |
15 | +wctomb_l(char *s, wchar_t wchar, locale_t loc) | |
16 | { | |
17 | static const mbstate_t initial; | |
18 | - static mbstate_t mbs; | |
19 | size_t rval; | |
20 | ||
21 | + NORMALIZE_LOCALE(loc); | |
22 | if (s == NULL) { | |
23 | /* No support for state dependent encodings. */ | |
24 | - mbs = initial; | |
25 | + loc->__mbs_wctomb = initial; | |
26 | return (0); | |
27 | } | |
28 | - if ((rval = __wcrtomb(s, wchar, &mbs)) == (size_t)-1) | |
29 | + if ((rval = loc->__lc_ctype->__wcrtomb(s, wchar, &loc->__mbs_wctomb, loc)) == (size_t)-1) | |
30 | return (-1); | |
31 | return ((int)rval); | |
32 | } | |
33 | + | |
34 | +int | |
35 | +wctomb(char *s, wchar_t wchar) | |
36 | +{ | |
37 | + return wctomb_l(s, wchar, __current_locale()); | |
38 | +} |