1 --- regexec.c.bsdnew 2009-11-11 11:29:04.000000000 -0800
2 +++ regexec.c 2009-11-11 12:21:46.000000000 -0800
3 @@ -39,6 +39,8 @@ static char sccsid[] = "@(#)regexec.c 8.
5 __FBSDID("$FreeBSD: src/lib/libc/regex/regexec.c,v 1.8 2007/06/11 03:05:54 delphij Exp $");
7 +#include "xlocale_private.h"
10 * the outer shell of regexec()
12 @@ -62,12 +64,12 @@ __FBSDID("$FreeBSD: src/lib/libc/regex/r
13 static int nope __unused = 0; /* for use in asserts; shuts lint up */
15 static __inline size_t
16 -xmbrtowc(wint_t *wi, const char *s, size_t n, mbstate_t *mbs, wint_t dummy)
17 +xmbrtowc(wint_t *wi, const char *s, size_t n, mbstate_t *mbs, wint_t dummy, locale_t loc)
22 - nr = mbrtowc(&wc, s, n, mbs);
23 + nr = mbrtowc_l(&wc, s, n, mbs, loc);
27 @@ -86,7 +88,8 @@ xmbrtowc_dummy(wint_t *wi,
30 mbstate_t *mbs __unused,
31 - wint_t dummy __unused)
32 + wint_t dummy __unused,
33 + locale_t loc __unused)
37 @@ -176,6 +179,8 @@ xmbrtowc_dummy(wint_t *wi,
39 #define LNAMES /* flag */
45 /* multibyte character & large states version */
46 @@ -224,7 +229,8 @@ regexec(const regex_t * __restrict preg,
48 eflags = GOODFLAGS(eflags);
51 + g->loc = __current_locale();
52 + if (MB_CUR_MAX_L(g->loc) > 1)
53 return(mmatcher(g, (char *)string, nmatch, pmatch, eflags));
54 else if (g->nstates <= CHAR_BIT*sizeof(states1) && !(eflags®_LARGE))
55 return(smatcher(g, (char *)string, nmatch, pmatch, eflags));