X-Git-Url: https://git.saurik.com/apple/libc.git/blobdiff_plain/3d9156a7a519a5e3aa1b92e9d9d4b991f1aed7ff..2be56ee90c5c5bee77895b8787a43e894249002b:/locale/FreeBSD/wcsrtombs.c?ds=sidebyside diff --git a/locale/FreeBSD/wcsrtombs.c b/locale/FreeBSD/wcsrtombs.c index 61e5432..483b862 100644 --- a/locale/FreeBSD/wcsrtombs.c +++ b/locale/FreeBSD/wcsrtombs.c @@ -27,19 +27,27 @@ #include __FBSDID("$FreeBSD: src/lib/libc/locale/wcsrtombs.c,v 1.6 2004/07/21 10:54:57 tjr Exp $"); +#include "xlocale_private.h" + #include #include #include #include #include "mblocal.h" +size_t +wcsrtombs_l(char * __restrict dst, const wchar_t ** __restrict src, size_t len, + mbstate_t * __restrict ps, locale_t loc) +{ + NORMALIZE_LOCALE(loc); + if (ps == NULL) + ps = &loc->__mbs_wcsrtombs; + return (loc->__lc_ctype->__wcsnrtombs(dst, src, SIZE_T_MAX, len, ps, loc)); +} + size_t wcsrtombs(char * __restrict dst, const wchar_t ** __restrict src, size_t len, mbstate_t * __restrict ps) { - static mbstate_t mbs; - - if (ps == NULL) - ps = &mbs; - return (__wcsnrtombs(dst, src, SIZE_T_MAX, len, ps)); + return wcsrtombs_l(dst, src, len, ps, __current_locale()); }