diff options
Diffstat (limited to 'pp_hot.c')
-rw-r--r-- | pp_hot.c | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -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. */ |