diff options
author | David Mitchell <davem@iabyn.com> | 2013-07-15 21:00:49 +0100 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2013-07-28 10:33:38 +0100 |
commit | 2b25edcf0363cd9d910984eaed0021da7872ff53 (patch) | |
tree | e8e0c16df056d35d1688d85a92ebbb434e04111c /pp_hot.c | |
parent | c67ab8f24d0803db4a06be9c3701dc61df55b9ba (diff) | |
download | perl-2b25edcf0363cd9d910984eaed0021da7872ff53.tar.gz |
pp_subst: reduce scope of 'i' variable
it's just used a temporary var in a few blocks; declare it individually
in each block rather than being scoped to the whole function.
Diffstat (limited to 'pp_hot.c')
-rw-r--r-- | pp_hot.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -2018,7 +2018,6 @@ PP(pp_subst) STRLEN clen; I32 iters = 0; I32 maxiters; - I32 i; bool once; U8 rxtainted = 0; /* holds various SUBST_TAINT_* flag bits. See "how taint works" above */ @@ -2180,6 +2179,7 @@ PP(pp_subst) if (once) { char *d, *m; + I32 i; if (RX_MATCH_TAINTED(rx)) /* run time pattern taint, eg locale */ rxtainted |= SUBST_TAINT_PAT; m = orig + RX_OFFS(rx)[0].start; @@ -2221,6 +2221,7 @@ PP(pp_subst) char *d, *m; d = s = RX_OFFS(rx)[0].start + orig; do { + I32 i; if (iters++ > maxiters) DIE(aTHX_ "Substitution loop"); if (RX_MATCH_TAINTED(rx)) /* run time pattern taint, eg locale */ @@ -2241,7 +2242,7 @@ PP(pp_subst) /* don't match same null twice */ REXEC_NOT_FIRST|REXEC_IGNOREPOS)); if (s != d) { - i = strend - s; + I32 i = strend - s; SvCUR_set(TARG, d - SvPVX_const(TARG) + i); Move(s, d, i+1, char); /* include the NUL */ } |