Abolish RXf_UTF8. Store the UTF-8-ness of the pattern with SvUTF8().
authorNicholas Clark <nick@ccl4.org>
Sat, 5 Jan 2008 17:15:30 +0000 (17:15 +0000)
committerNicholas Clark <nick@ccl4.org>
Sat, 5 Jan 2008 17:15:30 +0000 (17:15 +0000)
p4raw-id: //depot/perl@32852

op.c
pp_ctl.c
regcomp.c
regexec.c
regexp.h
regnodes.h

diff --git a/op.c b/op.c
index a0c4f35..4f8879e 100644 (file)
--- a/op.c
+++ b/op.c
@@ -3449,7 +3449,6 @@ Perl_pmruntime(pTHX_ OP *o, OP *expr, bool isreg)
            const char *const p = SvPV(pat, len);
            pat = newSVpvn_flags(p, len, SVs_TEMP);
        }
-       assert(!(pm_flags & RXf_UTF8));
 
        PM_SETRE(pm, CALLREGCOMP(pat, pm_flags));
 
index d2094f5..74c99cc 100644 (file)
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -159,7 +159,6 @@ PP(pp_regcomp)
                const char *const p = SvPV(tmpstr, len);
                tmpstr = newSVpvn_flags(p, len, SVs_TEMP);
            }
-           assert(!(pm_flags & RXf_UTF8));
 
                if (eng) 
                PM_SETRE(pm, CALLREGCOMP_ENG(eng, tmpstr, pm_flags));
index a7b1cf6..a4fb572 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -4176,9 +4176,6 @@ Perl_re_compile(pTHX_ const SV * const pattern, U32 pm_flags)
     DEBUG_r(if (!PL_colorset) reginitcolors());
 
     RExC_utf8 = RExC_orig_utf8 = SvUTF8(pattern);
-    assert(!(pm_flags & RXf_UTF8));
-    if (RExC_utf8)
-       pm_flags |= RXf_UTF8;
 
     DEBUG_COMPILE_r({
         SV *dsv= sv_newmortal();
@@ -4300,6 +4297,7 @@ redo_first_pass:
        p = sv_grow(rx, wraplen + 1);
        SvCUR_set(rx, wraplen);
        SvPOK_on(rx);
+       SvFLAGS(rx) |= SvUTF8(pattern);
         *p++='('; *p++='?';
         if (has_p)
             *p++ = KEEPCOPY_PAT_MOD; /*'p'*/
@@ -4413,7 +4411,7 @@ reStudy:
     /*dmq: removed as part of de-PMOP: pm->op_pmflags = RExC_flags; */
  
     if (UTF)
-        r->extflags |= RXf_UTF8;       /* Unicode in it? */
+       SvUTF8_on(rx);  /* Unicode in it? */
     ri->regstclass = NULL;
     if (RExC_naughty >= 10)    /* Probably an expensive pattern. */
        r->intflags |= PREGf_NAUGHTY;
@@ -9214,6 +9212,7 @@ Perl_reg_temp_copy (pTHX_ REGEXP *rx) {
        space in the copy is zero. As we've just done a struct copy, it's now
        a case of zero-ing that, rather than copying the current length.  */
     SvPV_set(ret_x, RX_WRAPPED(rx));
+    SvFLAGS(ret_x) |= SvFLAGS(rx) & (SVf_POK|SVp_POK|SVf_UTF8);
     StructCopy(r, ret, regexp);
     SvLEN_set(ret_x, 0);
     Newx(ret->offs, npar, regexp_paren_pair);
index 8144f99..dfe71f7 100644 (file)
--- a/regexec.c
+++ b/regexec.c
@@ -3767,7 +3767,6 @@ S_regmatch(pTHX_ regmatch_info *reginfo, regnode *prog)
                            const char *const p = SvPV(ret, len);
                            ret = newSVpvn_flags(p, len, SVs_TEMP);
                        }
-                       assert(!(pm_flags & RXf_UTF8));
                        rx = CALLREGCOMP(ret, pm_flags);
                        if (!(SvFLAGS(ret)
                              & (SVs_TEMP | SVs_PADTMP | SVf_READONLY
index 79bcacd..8b5a7bb 100644 (file)
--- a/regexp.h
+++ b/regexp.h
@@ -302,7 +302,6 @@ and check for NULL.
 #define RXf_CHECK_ALL          0x00040000
 
 /* UTF8 related */
-#define RXf_UTF8               0x00080000
 #define RXf_MATCH_UTF8         0x00100000
 
 /* Intuit related */
@@ -412,7 +411,7 @@ and check for NULL.
                        : (RX_MATCH_UTF8_off(prog), (PL_reg_match_utf8 = 0)))
 
 /* Whether the pattern stored at RX_WRAPPED is in UTF-8  */
-#define RX_UTF8(prog)                  (RX_EXTFLAGS(prog) & RXf_UTF8)
+#define RX_UTF8(prog)                  SvUTF8(prog)
     
 #define REXEC_COPY_STR 0x01            /* Need to copy the string. */
 #define REXEC_CHECKED  0x02            /* check_substr already checked. */
index b47e450..79de061 100644 (file)
@@ -625,7 +625,7 @@ EXTCONST char * const PL_reg_name[] = {
 EXTCONST char * PL_reg_extflags_name[];
 #else
 EXTCONST char * const PL_reg_extflags_name[] = {
-       /* Bits in extflags defined: 11111111111111111111111100111111 */
+       /* Bits in extflags defined: 11111111111101111111111100111111 */
        "MULTILINE",        /* 0x00000001 */
        "SINGLELINE",       /* 0x00000002 */
        "FOLD",             /* 0x00000004 */
@@ -645,7 +645,7 @@ EXTCONST char * const PL_reg_extflags_name[] = {
        "CANY_SEEN",        /* 0x00010000 */
        "NOSCAN",           /* 0x00020000 */
        "CHECK_ALL",        /* 0x00040000 */
-       "UTF8",             /* 0x00080000 */
+       "UNUSED_BIT_19",    /* 0x00080000 */
        "MATCH_UTF8",       /* 0x00100000 */
        "USE_INTUIT_NOML",  /* 0x00200000 */
        "USE_INTUIT_ML",    /* 0x00400000 */