]> git.saurik.com Git - apple/libc.git/blame - locale/FreeBSD/mbrlen.c.patch
Libc-391.2.3.tar.gz
[apple/libc.git] / locale / FreeBSD / mbrlen.c.patch
CommitLineData
3d9156a7
A
1--- mbrlen.c.orig Thu Nov 25 11:38:18 2004
2+++ mbrlen.c Fri Feb 18 16:54:36 2005
3@@ -27,15 +27,23 @@
4 #include <sys/cdefs.h>
5 __FBSDID("$FreeBSD: src/lib/libc/locale/mbrlen.c,v 1.4 2004/05/12 14:26:54 tjr Exp $");
6
7+#include "xlocale_private.h"
8+
9 #include <wchar.h>
10 #include "mblocal.h"
11
12 size_t
13-mbrlen(const char * __restrict s, size_t n, mbstate_t * __restrict ps)
14+mbrlen_l(const char * __restrict s, size_t n, mbstate_t * __restrict ps,
15+ locale_t loc)
16 {
17- static mbstate_t mbs;
18-
19+ NORMALIZE_LOCALE(loc);
20 if (ps == NULL)
21- ps = &mbs;
22- return (__mbrtowc(NULL, s, n, ps));
23+ ps = &loc->__mbs_mbrlen;
24+ return (loc->__lc_ctype->__mbrtowc(NULL, s, n, ps, loc));
25+}
26+
27+size_t
28+mbrlen(const char * __restrict s, size_t n, mbstate_t * __restrict ps)
29+{
30+ return mbrlen_l(s, n, ps, __current_locale());
31 }