X-Git-Url: https://git.saurik.com/apple/libc.git/blobdiff_plain/3d9156a7a519a5e3aa1b92e9d9d4b991f1aed7ff..2be56ee90c5c5bee77895b8787a43e894249002b:/locale/FreeBSD/mbrtowc.c diff --git a/locale/FreeBSD/mbrtowc.c b/locale/FreeBSD/mbrtowc.c index 9b19d10..023c8b2 100644 --- a/locale/FreeBSD/mbrtowc.c +++ b/locale/FreeBSD/mbrtowc.c @@ -27,16 +27,24 @@ #include __FBSDID("$FreeBSD: src/lib/libc/locale/mbrtowc.c,v 1.7 2004/05/12 14:09:04 tjr Exp $"); +#include "xlocale_private.h" + #include #include "mblocal.h" +size_t +mbrtowc_l(wchar_t * __restrict pwc, const char * __restrict s, + size_t n, mbstate_t * __restrict ps, locale_t loc) +{ + NORMALIZE_LOCALE(loc); + if (ps == NULL) + ps = &loc->__mbs_mbrtowc; + return (loc->__lc_ctype->__mbrtowc(pwc, s, n, ps, loc)); +} + size_t mbrtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n, mbstate_t * __restrict ps) { - static mbstate_t mbs; - - if (ps == NULL) - ps = &mbs; - return (__mbrtowc(pwc, s, n, ps)); + return mbrtowc_l(pwc, s, n, ps, __current_locale()); }