diff options
author | David Mitchell <davem@iabyn.com> | 2013-07-15 20:17:51 +0100 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2013-07-28 10:33:38 +0100 |
commit | 0395280b7347cbc0bb0d8dbf21e65b85f7e80c4c (patch) | |
tree | c5ffcc3cac9f3595904179f0f6ad28b8211656ef /pp_hot.c | |
parent | 39b40493c96b93db5e5812d0a8923039da82a142 (diff) | |
download | perl-0395280b7347cbc0bb0d8dbf21e65b85f7e80c4c.tar.gz |
pp_subst: set/use s,m vars near where they're used
This should be just a cosmetic change; but basically change stuff like
m = orig;
s = foo();
... lots of lines not using s or m ...
bar(m,s)
... more stuff using s ...
to
... lots of lines not using s or m ...
s = foo();
bar(orig,s)
... more stuff using s ...
This is part of few commits to generally clean up the scope and
comprehensibility of the vars within pp_subst
Diffstat (limited to 'pp_hot.c')
-rw-r--r-- | pp_hot.c | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -2117,17 +2117,13 @@ PP(pp_subst) r_flags = REXEC_COPY_STR; #endif - m = s = orig; - - if (!CALLREGEXEC(rx, s, strend, orig, 0, TARG, NULL, r_flags)) + if (!CALLREGEXEC(rx, orig, strend, orig, 0, TARG, NULL, r_flags)) { SPAGAIN; PUSHs(rpm->op_pmflags & PMf_NONDESTRUCT ? TARG : &PL_sv_no); LEAVE_SCOPE(oldsave); RETURN; } - s = RX_OFFS(rx)[0].start + orig; - PL_curpm = pm; /* known replacement string? */ @@ -2223,7 +2219,8 @@ PP(pp_subst) PUSHs(&PL_sv_yes); } else { - char *d = s; + char *d; + d = s = RX_OFFS(rx)[0].start + orig; do { if (iters++ > maxiters) DIE(aTHX_ "Substitution loop"); @@ -2277,10 +2274,13 @@ PP(pp_subst) if (RX_MATCH_TAINTED(rx)) /* run time pattern taint, eg locale */ rxtainted |= SUBST_TAINT_PAT; repl = dstr; - dstr = newSVpvn_flags(m, s-m, SVs_TEMP | (DO_UTF8(TARG) ? SVf_UTF8 : 0)); + s = RX_OFFS(rx)[0].start + orig; + dstr = newSVpvn_flags(orig, s-orig, + SVs_TEMP | (DO_UTF8(TARG) ? SVf_UTF8 : 0)); if (!c) { PERL_CONTEXT *cx; SPAGAIN; + m = orig; /* note that a whole bunch of local vars are saved here for * use by pp_substcont: here's a list of them in case you're * searching for places in this sub that uses a particular var: |