regex2.h.patch   [plain text]


--- regex2.h.orig	2004-11-25 11:38:32.000000000 -0800
+++ regex2.h	2005-02-24 14:26:21.000000000 -0800
@@ -127,9 +127,10 @@
 } cset;
 
 static int
-CHIN1(cs, ch)
+CHIN1(cs, ch, loc)
 cset *cs;
 wint_t ch;
+locale_t loc;
 {
 	int i;
 
@@ -144,15 +145,16 @@
 		if (cs->ranges[i].min <= ch && ch <= cs->ranges[i].max)
 			return (!cs->invert);
 	for (i = 0; i < cs->ntypes; i++)
-		if (iswctype(ch, cs->types[i]))
+		if (iswctype_l(ch, cs->types[i], loc))
 			return (!cs->invert);
 	return (cs->invert);
 }
 
 static __inline int
-CHIN(cs, ch)
+CHIN(cs, ch, loc)
 cset *cs;
 wint_t ch;
+locale_t loc;
 {
 
 	assert(ch >= 0);
@@ -160,10 +162,10 @@
 		return (((cs->bmp[ch >> 3] & (1 << (ch & 7))) != 0) ^
 		    cs->invert);
 	else if (cs->icase)
-		return (CHIN1(cs, ch) || CHIN1(cs, towlower(ch)) ||
-		    CHIN1(cs, towupper(ch)));
+		return (CHIN1(cs, ch, loc) || CHIN1(cs, towlower_l(ch, loc), loc) ||
+		    CHIN1(cs, towupper_l(ch, loc), loc));
 	else
-		return (CHIN1(cs, ch));
+		return (CHIN1(cs, ch, loc));
 }
 
 /*
@@ -193,8 +195,9 @@
 	size_t nsub;		/* copy of re_nsub */
 	int backrefs;		/* does it use back references? */
 	sopno nplus;		/* how deep does it nest +s? */
+	locale_t loc;		/* current locale */
 };
 
 /* misc utilities */
 #define	OUT	(-2)	/* a non-character value */
-#define ISWORD(c)       (iswalnum((uch)(c)) || (c) == '_')
+#define ISWORD(c,l)     (iswalnum_l((uch)(c), l) || (c) == '_')