summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2013-07-15 20:37:44 +0100
committerDavid Mitchell <davem@iabyn.com>2013-07-28 10:33:38 +0100
commitc67ab8f24d0803db4a06be9c3701dc61df55b9ba (patch)
treed042b8c3029b1c40c7f07f7d1abe121876f818e3
parent0395280b7347cbc0bb0d8dbf21e65b85f7e80c4c (diff)
downloadperl-c67ab8f24d0803db4a06be9c3701dc61df55b9ba.tar.gz
pp_subst: reduce scope of 'm' var
its mainly just a temporary local var; declare it individually within each scope that makes use of it.
-rw-r--r--pp_hot.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/pp_hot.c b/pp_hot.c
index c93e8830ed..c7c562bf1e 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -2014,7 +2014,6 @@ PP(pp_subst)
PMOP *rpm = pm;
char *s;
char *strend;
- char *m;
const char *c;
STRLEN clen;
I32 iters = 0;
@@ -2180,7 +2179,7 @@ PP(pp_subst)
}
if (once) {
- char *d;
+ char *d, *m;
if (RX_MATCH_TAINTED(rx)) /* run time pattern taint, eg locale */
rxtainted |= SUBST_TAINT_PAT;
m = orig + RX_OFFS(rx)[0].start;
@@ -2219,7 +2218,7 @@ PP(pp_subst)
PUSHs(&PL_sv_yes);
}
else {
- char *d;
+ char *d, *m;
d = s = RX_OFFS(rx)[0].start + orig;
do {
if (iters++ > maxiters)
@@ -2252,6 +2251,7 @@ PP(pp_subst)
}
else {
bool first;
+ char *m;
SV *repl;
if (force_on_match) {
/* redo the first match, this time with the orig var
@@ -2297,12 +2297,13 @@ PP(pp_subst)
if (RX_MATCH_TAINTED(rx))
rxtainted |= SUBST_TAINT_PAT;
if (RX_MATCH_COPIED(rx) && RX_SUBBEG(rx) != orig) {
- m = s;
- s = orig;
+ char *old_s = s;
+ char *old_orig = orig;
assert(RX_SUBOFFSET(rx) == 0);
+
orig = RX_SUBBEG(rx);
- s = orig + (m - s);
- strend = s + (strend - m);
+ s = orig + (old_s - old_orig);
+ strend = s + (strend - old_s);
}
m = RX_OFFS(rx)[0].start + orig;
sv_catpvn_nomg_maybeutf8(dstr, s, m - s, DO_UTF8(TARG));