This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
pp_subst: move a common block outside an if/then
authorDavid Mitchell <davem@iabyn.com>
Sun, 6 Feb 2011 21:13:11 +0000 (21:13 +0000)
committerDavid Mitchell <davem@iabyn.com>
Sun, 6 Feb 2011 21:34:44 +0000 (21:34 +0000)
The last few commits have been working towards making two
blocks of code identical. Now it's payback time!

pp_hot.c

index 941dd04..66198a2 100644 (file)
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -2319,14 +2319,6 @@ PP(pp_subst)
            else
                mPUSHi((I32)iters);
        }
-       (void)SvPOK_only_UTF8(TARG);
-       if (doutf8)
-           SvUTF8_on(TARG);
-       TAINT_IF(rxtainted);
-       SvSETMAGIC(TARG);
-       SvTAINT(TARG);
-       LEAVE_SCOPE(oldsave);
-       RETURN;
     }
     else {
        if (force_on_match) {
@@ -2401,17 +2393,15 @@ PP(pp_subst)
            PUSHs(TARG);
        else
            mPUSHi((I32)iters);
-
-       (void)SvPOK_only_UTF8(TARG);
-       if (doutf8)
-           SvUTF8_on(TARG);
-       TAINT_IF(rxtainted);
-       SvSETMAGIC(TARG);
-       SvTAINT(TARG);
-       LEAVE_SCOPE(oldsave);
-       RETURN;
     }
-    /* NOTREACHED */
+    (void)SvPOK_only_UTF8(TARG);
+    if (doutf8)
+       SvUTF8_on(TARG);
+    TAINT_IF(rxtainted);
+    SvSETMAGIC(TARG);
+    SvTAINT(TARG);
+    LEAVE_SCOPE(oldsave);
+    RETURN;
 }
 
 PP(pp_grepwhile)