X-Git-Url: https://git.saurik.com/apple/libc.git/blobdiff_plain/3d9156a7a519a5e3aa1b92e9d9d4b991f1aed7ff..15de9d6b4ab2de27ae24b13b7b6c4d55fffe4aef:/locale/FreeBSD/mbrtowc.c?ds=sidebyside 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()); }