1 --- mbsnrtowcs.c.orig Thu Nov 25 11:38:18 2004
2 +++ mbsnrtowcs.c Fri Feb 18 16:57:14 2005
5 __FBSDID("$FreeBSD: src/lib/libc/locale/mbsnrtowcs.c,v 1.1 2004/07/21 10:54:57 tjr Exp $");
7 +#include "xlocale_private.h"
16 -mbsnrtowcs(wchar_t * __restrict dst, const char ** __restrict src,
17 - size_t nms, size_t len, mbstate_t * __restrict ps)
18 +mbsnrtowcs_l(wchar_t * __restrict dst, const char ** __restrict src,
19 + size_t nms, size_t len, mbstate_t * __restrict ps, locale_t loc)
21 - static mbstate_t mbs;
23 + NORMALIZE_LOCALE(loc);
26 - return (__mbsnrtowcs(dst, src, nms, len, ps));
27 + ps = &loc->__mbs_mbsnrtowcs;
28 + return (loc->__lc_ctype->__mbsnrtowcs(dst, src, nms, len, ps, loc));
32 -__mbsnrtowcs_std(wchar_t * __restrict dst, const char ** __restrict src,
33 +mbsnrtowcs(wchar_t * __restrict dst, const char ** __restrict src,
34 size_t nms, size_t len, mbstate_t * __restrict ps)
36 + return mbsnrtowcs_l(dst, src, nms, len, ps, __current_locale());
39 +__private_extern__ size_t
40 +__mbsnrtowcs_std(wchar_t * __restrict dst, const char ** __restrict src,
41 + size_t nms, size_t len, mbstate_t * __restrict ps, locale_t loc)
47 + size_t (*__mbrtowc)(wchar_t * __restrict, const char * __restrict,
48 + size_t, mbstate_t * __restrict, locale_t)
49 + = loc->__lc_ctype->__mbrtowc;
56 - if ((nb = __mbrtowc(&wc, s, nms, ps)) == (size_t)-1)
57 + if ((nb = __mbrtowc(&wc, s, nms, ps, loc)) == (size_t)-1)
58 /* Invalid sequence - mbrtowc() sets errno. */
60 else if (nb == 0 || nb == (size_t)-2)
65 - if ((nb = __mbrtowc(dst, s, nms, ps)) == (size_t)-1) {
66 + if ((nb = __mbrtowc(dst, s, nms, ps, loc)) == (size_t)-1) {
69 } else if (nb == (size_t)-2) {