summaryrefslogtreecommitdiff
path: root/pp_hot.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2001-08-18 14:24:42 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2001-08-18 14:24:42 +0000
commitd9f424b23bb434af43f899daf2cb6cfe42fe6e1a (patch)
treea04a1a4067438cca3b5395a68ab540e71418e9c9 /pp_hot.c
parent8b1981a6c4fcb68914e5a9c635d9471dbbe6f42a (diff)
downloadperl-d9f424b23bb434af43f899daf2cb6cfe42fe6e1a.tar.gz
New try for ID 20010407.006: detach the semantics
"was the last match target UTF8" into its own variable. p4raw-id: //depot/perl@11717
Diffstat (limited to 'pp_hot.c')
-rw-r--r--pp_hot.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/pp_hot.c b/pp_hot.c
index 0f4a69326e..d21977691b 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -1222,7 +1222,7 @@ PP(pp_match)
TARG = DEFSV;
EXTEND(SP,1);
}
- PL_reg_sv = TARG;
+
PUTBACK; /* EVAL blocks need stack_sp. */
s = SvPV(TARG, len);
strend = s + len;
@@ -1232,6 +1232,8 @@ PP(pp_match)
(PL_tainted && (pm->op_pmflags & PMf_RETAINT)));
TAINT_NOT;
+ PL_reg_sv_utf8 = DO_UTF8(TARG);
+
if (pm->op_pmdynflags & PMdf_USED) {
failure:
if (gimme == G_ARRAY)
@@ -1398,7 +1400,7 @@ yup: /* Confirmed by INTUIT */
if (global) {
rx->subbeg = truebase;
rx->startp[0] = s - truebase;
- if (DO_UTF8(PL_reg_sv)) {
+ if (PL_reg_sv_utf8) {
char *t = (char*)utf8_hop((U8*)s, rx->minlen);
rx->endp[0] = t - truebase;
}
@@ -1898,7 +1900,6 @@ PP(pp_subst)
STRLEN len;
int force_on_match = 0;
I32 oldsave = PL_savestack_ix;
- bool do_utf8;
STRLEN slen;
/* known replacement string? */
@@ -1909,8 +1910,7 @@ PP(pp_subst)
TARG = DEFSV;
EXTEND(SP,1);
}
- PL_reg_sv = TARG;
- do_utf8 = DO_UTF8(PL_reg_sv);
+
if (SvFAKE(TARG) && SvREADONLY(TARG))
sv_force_normal(TARG);
if (SvREADONLY(TARG)
@@ -1928,12 +1928,14 @@ PP(pp_subst)
rxtainted |= 2;
TAINT_NOT;
+ PL_reg_sv_utf8 = DO_UTF8(TARG);
+
force_it:
if (!pm || !s)
DIE(aTHX_ "panic: pp_subst");
strend = s + len;
- slen = do_utf8 ? utf8_length((U8*)s, (U8*)strend) : len;
+ slen = PL_reg_sv_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. */