Rename the variable: it *used* to be (wrongly) that the
Jarkko Hietaniemi [Sun, 2 Sep 2001 10:02:20 +0000 (10:02 +0000)]
code related to PL_reg_sv (so PL_reg_sv_utf8 was logical)
but that is no more the case: PL_reg_match_utf8 is better.

p4raw-id: //depot/perl@11823

embedvar.h
mg.c
perlapi.h
pp.c
pp_hot.c
regcomp.c
regexec.c
sv.c
thrdvar.h

index 4fa56ac..92e9e91 100644 (file)
@@ -81,6 +81,7 @@
 #define PL_reg_ganch           (vTHX->Treg_ganch)
 #define PL_reg_leftiter                (vTHX->Treg_leftiter)
 #define PL_reg_magic           (vTHX->Treg_magic)
+#define PL_reg_match_utf8      (vTHX->Treg_match_utf8)
 #define PL_reg_maxiter         (vTHX->Treg_maxiter)
 #define PL_reg_oldcurpm                (vTHX->Treg_oldcurpm)
 #define PL_reg_oldpos          (vTHX->Treg_oldpos)
@@ -93,7 +94,6 @@
 #define PL_reg_start_tmpl      (vTHX->Treg_start_tmpl)
 #define PL_reg_starttry                (vTHX->Treg_starttry)
 #define PL_reg_sv              (vTHX->Treg_sv)
-#define PL_reg_sv_utf8         (vTHX->Treg_sv_utf8)
 #define PL_reg_whilem_seen     (vTHX->Treg_whilem_seen)
 #define PL_regbol              (vTHX->Tregbol)
 #define PL_regcc               (vTHX->Tregcc)
 #define PL_reg_ganch           (aTHX->Treg_ganch)
 #define PL_reg_leftiter                (aTHX->Treg_leftiter)
 #define PL_reg_magic           (aTHX->Treg_magic)
+#define PL_reg_match_utf8      (aTHX->Treg_match_utf8)
 #define PL_reg_maxiter         (aTHX->Treg_maxiter)
 #define PL_reg_oldcurpm                (aTHX->Treg_oldcurpm)
 #define PL_reg_oldpos          (aTHX->Treg_oldpos)
 #define PL_reg_start_tmpl      (aTHX->Treg_start_tmpl)
 #define PL_reg_starttry                (aTHX->Treg_starttry)
 #define PL_reg_sv              (aTHX->Treg_sv)
-#define PL_reg_sv_utf8         (aTHX->Treg_sv_utf8)
 #define PL_reg_whilem_seen     (aTHX->Treg_whilem_seen)
 #define PL_regbol              (aTHX->Tregbol)
 #define PL_regcc               (aTHX->Tregcc)
 #define PL_Treg_ganch          PL_reg_ganch
 #define PL_Treg_leftiter       PL_reg_leftiter
 #define PL_Treg_magic          PL_reg_magic
+#define PL_Treg_match_utf8     PL_reg_match_utf8
 #define PL_Treg_maxiter                PL_reg_maxiter
 #define PL_Treg_oldcurpm       PL_reg_oldcurpm
 #define PL_Treg_oldpos         PL_reg_oldpos
 #define PL_Treg_start_tmpl     PL_reg_start_tmpl
 #define PL_Treg_starttry       PL_reg_starttry
 #define PL_Treg_sv             PL_reg_sv
-#define PL_Treg_sv_utf8                PL_reg_sv_utf8
 #define PL_Treg_whilem_seen    PL_reg_whilem_seen
 #define PL_Tregbol             PL_regbol
 #define PL_Tregcc              PL_regcc
diff --git a/mg.c b/mg.c
index 5511c09..ef6963d 100644 (file)
--- a/mg.c
+++ b/mg.c
@@ -392,7 +392,7 @@ Perl_magic_regdatum_get(pTHX_ SV *sv, MAGIC *mg)
                else                    /* @- */
                    i = s;
                
-               if (i > 0 && PL_reg_sv_utf8) {
+               if (i > 0 && PL_reg_match_utf8) {
                    char *b = rx->subbeg;
                    if (b)
                        i = Perl_utf8_length(aTHX_ (U8*)b, (U8*)(b+i));
@@ -433,7 +433,7 @@ Perl_magic_len(pTHX_ SV *sv, MAGIC *mg)
            {
                i = t1 - s1;
              getlen:
-               if (i > 0 && PL_reg_sv_utf8) {
+               if (i > 0 && PL_reg_match_utf8) {
                    char *s    = rx->subbeg + s1;
                    char *send = rx->subbeg + t1;
 
@@ -666,7 +666,7 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg)
                        PL_tainted = FALSE;
                    }
                    sv_setpvn(sv, s, i);
-                   if (PL_reg_sv_utf8 && is_utf8_string((U8*)s, i))
+                   if (PL_reg_match_utf8 && is_utf8_string((U8*)s, i))
                        SvUTF8_on(sv);
                    else
                        SvUTF8_off(sv);
index 355bf6f..3b85666 100644 (file)
--- a/perlapi.h
+++ b/perlapi.h
@@ -745,6 +745,8 @@ END_EXTERN_C
 #define PL_reg_leftiter                (*Perl_Treg_leftiter_ptr(aTHX))
 #undef  PL_reg_magic
 #define PL_reg_magic           (*Perl_Treg_magic_ptr(aTHX))
+#undef  PL_reg_match_utf8
+#define PL_reg_match_utf8      (*Perl_Treg_match_utf8_ptr(aTHX))
 #undef  PL_reg_maxiter
 #define PL_reg_maxiter         (*Perl_Treg_maxiter_ptr(aTHX))
 #undef  PL_reg_oldcurpm
@@ -769,8 +771,6 @@ END_EXTERN_C
 #define PL_reg_starttry                (*Perl_Treg_starttry_ptr(aTHX))
 #undef  PL_reg_sv
 #define PL_reg_sv              (*Perl_Treg_sv_ptr(aTHX))
-#undef  PL_reg_sv_utf8
-#define PL_reg_sv_utf8         (*Perl_Treg_sv_utf8_ptr(aTHX))
 #undef  PL_reg_whilem_seen
 #define PL_reg_whilem_seen     (*Perl_Treg_whilem_seen_ptr(aTHX))
 #undef  PL_regbol
diff --git a/pp.c b/pp.c
index 9c5fad8..5538cf4 100644 (file)
--- a/pp.c
+++ b/pp.c
@@ -4165,7 +4165,7 @@ PP(pp_split)
     TAINT_IF((pm->op_pmflags & PMf_LOCALE) &&
             (pm->op_pmflags & (PMf_WHITE | PMf_SKIPWHITE)));
 
-    PL_reg_sv_utf8 = do_utf8;
+    PL_reg_match_utf8 = do_utf8;
 
     if (pm->op_pmreplroot) {
 #ifdef USE_ITHREADS
index bc57075..8c04a70 100644 (file)
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -1232,7 +1232,7 @@ PP(pp_match)
                 (PL_tainted && (pm->op_pmflags & PMf_RETAINT)));
     TAINT_NOT;
 
-    PL_reg_sv_utf8 = DO_UTF8(TARG);
+    PL_reg_match_utf8 = DO_UTF8(TARG);
 
     if (pm->op_pmdynflags & PMdf_USED) {
       failure:
@@ -1400,7 +1400,7 @@ yup:                                      /* Confirmed by INTUIT */
     if (global) {
        rx->subbeg = truebase;
        rx->startp[0] = s - truebase;
-       if (PL_reg_sv_utf8) {
+       if (PL_reg_match_utf8) {
            char *t = (char*)utf8_hop((U8*)s, rx->minlen);
            rx->endp[0] = t - truebase;
        }
@@ -1928,14 +1928,14 @@ PP(pp_subst)
        rxtainted |= 2;
     TAINT_NOT;
 
-    PL_reg_sv_utf8 = DO_UTF8(TARG);
+    PL_reg_match_utf8 = DO_UTF8(TARG);
 
   force_it:
     if (!pm || !s)
        DIE(aTHX_ "panic: pp_subst");
 
     strend = s + len;
-    slen = PL_reg_sv_utf8 ? utf8_length((U8*)s, (U8*)strend) : len;
+    slen = PL_reg_match_utf8 ? utf8_length((U8*)s, (U8*)strend) : len;
     maxiters = 2 * slen + 10;  /* We can match twice at each
                                   position, once with zero-length,
                                   second time with non-zero. */
index 093eed0..dfe3080 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -4731,7 +4731,7 @@ Perl_save_re_context(pTHX)
     SAVEVPTR(PL_reg_re);               /* from regexec.c */
     SAVEPPTR(PL_reg_ganch);            /* from regexec.c */
     SAVESPTR(PL_reg_sv);               /* from regexec.c */
-    SAVEI8(PL_reg_sv_utf8);            /* from regexec.c */
+    SAVEI8(PL_reg_match_utf8);         /* from regexec.c */
     SAVEVPTR(PL_reg_magic);            /* from regexec.c */
     SAVEI32(PL_reg_oldpos);                    /* from regexec.c */
     SAVEVPTR(PL_reg_oldcurpm);         /* from regexec.c */
index 6adb9ca..a85a692 100644 (file)
--- a/regexec.c
+++ b/regexec.c
  */
 
 #define CHR_SVLEN(sv) (UTF ? sv_len_utf8(sv) : SvCUR(sv))
-#define CHR_DIST(a,b) (PL_reg_sv_utf8 ? utf8_distance(a,b) : a - b)
+#define CHR_DIST(a,b) (PL_reg_match_utf8 ? utf8_distance(a,b) : a - b)
 
 #define reghop_c(pos,off) ((char*)reghop((U8*)pos, off))
 #define reghopmaybe_c(pos,off) ((char*)reghopmaybe((U8*)pos, off))
-#define HOP(pos,off) (PL_reg_sv_utf8 ? reghop((U8*)pos, off) : (U8*)(pos + off))
-#define HOPMAYBE(pos,off) (PL_reg_sv_utf8 ? reghopmaybe((U8*)pos, off) : (U8*)(pos + off))
+#define HOP(pos,off) (PL_reg_match_utf8 ? reghop((U8*)pos, off) : (U8*)(pos + off))
+#define HOPMAYBE(pos,off) (PL_reg_match_utf8 ? reghopmaybe((U8*)pos, off) : (U8*)(pos + off))
 #define HOPc(pos,off) ((char*)HOP(pos,off))
 #define HOPMAYBEc(pos,off) ((char*)HOPMAYBE(pos,off))
 
 #define HOPBACK(pos, off) (            \
-    (UTF && PL_reg_sv_utf8)            \
+    (UTF && PL_reg_match_utf8)         \
        ? reghopmaybe((U8*)pos, -off)   \
     : (pos - off >= PL_bostr)          \
        ? (U8*)(pos - off)              \
 
 #define reghop3_c(pos,off,lim) ((char*)reghop3((U8*)pos, off, (U8*)lim))
 #define reghopmaybe3_c(pos,off,lim) ((char*)reghopmaybe3((U8*)pos, off, (U8*)lim))
-#define HOP3(pos,off,lim) (PL_reg_sv_utf8 ? reghop3((U8*)pos, off, (U8*)lim) : (U8*)(pos + off))
-#define HOPMAYBE3(pos,off,lim) (PL_reg_sv_utf8 ? reghopmaybe3((U8*)pos, off, (U8*)lim) : (U8*)(pos + off))
+#define HOP3(pos,off,lim) (PL_reg_match_utf8 ? reghop3((U8*)pos, off, (U8*)lim) : (U8*)(pos + off))
+#define HOPMAYBE3(pos,off,lim) (PL_reg_match_utf8 ? reghopmaybe3((U8*)pos, off, (U8*)lim) : (U8*)(pos + off))
 #define HOP3c(pos,off,lim) ((char*)HOP3(pos,off,lim))
 #define HOPMAYBE3c(pos,off,lim) ((char*)HOPMAYBE3(pos,off,lim))
 
@@ -872,7 +872,7 @@ S_find_byclass(pTHX_ regexp * prog, regnode *c, char *s, char *strend, char *sta
        unsigned int c2;
        char *e;
        register I32 tmp = 1;   /* Scratch variable? */
-       register bool do_utf8 = PL_reg_sv_utf8;
+       register bool do_utf8 = PL_reg_match_utf8;
 
        /* We know what class it must start with. */
        switch (OP(c)) {
@@ -2003,7 +2003,7 @@ S_regmatch(pTHX_ regnode *prog)
 #if 0
     I32 firstcp = PL_savestack_ix;
 #endif
-    register bool do_utf8 = PL_reg_sv_utf8;
+    register bool do_utf8 = PL_reg_match_utf8;
 
 #ifdef DEBUGGING
     PL_regindent++;
@@ -3584,7 +3584,7 @@ S_regrepeat(pTHX_ regnode *p, I32 max)
     register I32 c;
     register char *loceol = PL_regeol;
     register I32 hardcount = 0;
-    register bool do_utf8 = PL_reg_sv_utf8;
+    register bool do_utf8 = PL_reg_match_utf8;
 
     scan = PL_reginput;
     if (max != REG_INFTY && max < loceol - scan)
@@ -3823,7 +3823,7 @@ S_regrepeat_hard(pTHX_ regnode *p, I32 max, I32 *lp)
        return 0;
 
     start = PL_reginput;
-    if (PL_reg_sv_utf8) {
+    if (PL_reg_match_utf8) {
        while (PL_reginput < loceol && (scan = PL_reginput, res = regmatch(p))) {
            if (!count++) {
                l = 0;
diff --git a/sv.c b/sv.c
index 8713bf6..3250d2a 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -10239,7 +10239,7 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags,
     PL_reg_re          = (regexp*)NULL;
     PL_reg_ganch       = Nullch;
     PL_reg_sv          = Nullsv;
-    PL_reg_sv_utf8     = FALSE;
+    PL_reg_match_utf8  = FALSE;
     PL_reg_magic       = (MAGIC*)NULL;
     PL_reg_oldpos      = 0;
     PL_reg_oldcurpm    = (PMOP*)NULL;
index d5bbeac..8ebc533 100644 (file)
--- a/thrdvar.h
+++ b/thrdvar.h
@@ -259,5 +259,5 @@ PERLVAR(thr_done,   bool)           /* True when the thread has finished */
 
 #endif /* USE_5005THREADS */
 
-PERLVAR(Treg_sv_utf8,  bool)           /* was what we matched against utf8 */
+PERLVAR(Treg_match_utf8,       bool)           /* was what we matched against utf8 */