pp_subst: reduce scope of 'd' variable
authorDavid Mitchell <davem@iabyn.com>
Mon, 15 Jul 2013 18:54:53 +0000 (19:54 +0100)
committerDavid Mitchell <davem@iabyn.com>
Sun, 28 Jul 2013 09:33:38 +0000 (10:33 +0100)
It's just used as a temporary value in two branches;
so make it a local var in each of those branches.

pp_hot.c

index aa8d552..c43de40 100644 (file)
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -2016,7 +2016,6 @@ PP(pp_subst)
     char *strend;
     char *m;
     const char *c;
-    char *d;
     STRLEN clen;
     I32 iters = 0;
     I32 maxiters;
@@ -2183,8 +2182,9 @@ PP(pp_subst)
            orig = SvPV_force_nomg(TARG, len);
            goto force_it;
        }
-       d = s;
+
        if (once) {
+            char *d;
            if (RX_MATCH_TAINTED(rx)) /* run time pattern taint, eg locale */
                rxtainted |= SUBST_TAINT_PAT;
            m = orig + RX_OFFS(rx)[0].start;
@@ -2223,6 +2223,7 @@ PP(pp_subst)
            PUSHs(&PL_sv_yes);
        }
        else {
+            char *d = s;
            do {
                if (iters++ > maxiters)
                    DIE(aTHX_ "Substitution loop");