X-Git-Url: https://git.saurik.com/apple/libc.git/blobdiff_plain/3d9156a7a519a5e3aa1b92e9d9d4b991f1aed7ff..HEAD:/locale/FreeBSD/mbrlen.c diff --git a/locale/FreeBSD/mbrlen.c b/locale/FreeBSD/mbrlen.c index 33f7ea0..2f0227a 100644 --- a/locale/FreeBSD/mbrlen.c +++ b/locale/FreeBSD/mbrlen.c @@ -27,15 +27,23 @@ #include __FBSDID("$FreeBSD: src/lib/libc/locale/mbrlen.c,v 1.4 2004/05/12 14:26:54 tjr Exp $"); +#include "xlocale_private.h" + #include #include "mblocal.h" size_t -mbrlen(const char * __restrict s, size_t n, mbstate_t * __restrict ps) +mbrlen_l(const char * __restrict s, size_t n, mbstate_t * __restrict ps, + locale_t loc) { - static mbstate_t mbs; - + NORMALIZE_LOCALE(loc); if (ps == NULL) - ps = &mbs; - return (__mbrtowc(NULL, s, n, ps)); + ps = &loc->__mbs_mbrlen; + return (loc->__lc_ctype->__mbrtowc(NULL, s, n, ps, loc)); +} + +size_t +mbrlen(const char * __restrict s, size_t n, mbstate_t * __restrict ps) +{ + return mbrlen_l(s, n, ps, __current_locale()); }