summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Williamson <public@khwilliamson.com>2010-12-06 15:11:59 -0700
committerKarl Williamson <public@khwilliamson.com>2010-12-11 15:57:23 -0700
commitb8e7c664739512d97c3d65f44d80a53754521f15 (patch)
tree084c4b29b70069e74792ddb1e0253664b72bc089
parentffc130aa464ab42cfe8e8a19205f5b398675d98f (diff)
downloadperl-b8e7c664739512d97c3d65f44d80a53754521f15.tar.gz
regcomp.c: Remove no longer necessary loop
Recent changes to this cause the bitmap to be populated where possible with the all folding taken into consideration. Therefore, the FOLD flag isn't necessary except when that wasn't possible, and the loop that went through looking for folds is also not necessary, as the bitmap is now completely populated before it gets to where the loop was.
-rw-r--r--regcomp.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/regcomp.c b/regcomp.c
index 3136904e47..c81fe12db6 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -8382,8 +8382,6 @@ S_regclass(pTHX_ RExC_state_t *pRExC_state, U32 depth)
}
else {
RExC_emit += ANYOF_SKIP;
- if (FOLD)
- ANYOF_FLAGS(ret) |= ANYOF_FOLD;
if (LOC)
ANYOF_FLAGS(ret) |= ANYOF_LOCALE;
ANYOF_BITMAP_ZERO(ret);
@@ -8903,6 +8901,12 @@ parseit:
return ret;
/****** !SIZE_ONLY AFTER HERE *********/
+ /* Folding in the bitmap is taken care of above, but not for locale, for
+ * which we have to wait to see what folding is in effect at runtime, and
+ * for things not in the bitmap */
+ if (FOLD && (LOC || ANYOF_FLAGS(ret) & ANYOF_NONBITMAP)) {
+ ANYOF_FLAGS(ret) |= ANYOF_FOLD;
+ }
if( stored == 1 && (value < 128 || (value < 256 && !UTF))
&& !( ANYOF_FLAGS(ret) & ( ANYOF_FLAGS_ALL ^ ANYOF_FOLD ) )
) {
@@ -8926,20 +8930,6 @@ parseit:
SvREFCNT_dec(listsv);
return ret;
}
- /* optimize case-insensitive simple patterns (e.g. /[a-z]/i) */
- if ( /* If the only flag is folding (plus possibly inversion). */
- ((ANYOF_FLAGS(ret) & (ANYOF_FLAGS_ALL ^ ANYOF_INVERT)) == ANYOF_FOLD)
- ) {
- for (value = 0; value < 256; ++value) {
- if (ANYOF_BITMAP_TEST(ret, value)) {
- UV fold = PL_fold[value];
-
- if (fold != value)
- ANYOF_BITMAP_SET(ret, fold);
- }
- }
- ANYOF_FLAGS(ret) &= ~ANYOF_FOLD;
- }
/* optimize inverted simple patterns (e.g. [^a-z]) */
if (optimize_invert &&