summaryrefslogtreecommitdiff
path: root/pp_hot.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2013-07-15 21:00:49 +0100
committerDavid Mitchell <davem@iabyn.com>2013-07-28 10:33:38 +0100
commit2b25edcf0363cd9d910984eaed0021da7872ff53 (patch)
treee8e0c16df056d35d1688d85a92ebbb434e04111c /pp_hot.c
parentc67ab8f24d0803db4a06be9c3701dc61df55b9ba (diff)
downloadperl-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.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/pp_hot.c b/pp_hot.c
index c7c562bf1e..8c36b46fca 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -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 */
}