Move the call to Perl_cv_clone() into S_doform(), from its two callers.
authorNicholas Clark <nick@ccl4.org>
Wed, 1 Sep 2010 09:56:47 +0000 (10:56 +0100)
committerNicholas Clark <nick@ccl4.org>
Wed, 1 Sep 2010 09:56:47 +0000 (10:56 +0100)
This reduces code duplication slightly, and reduces the object code size.

pp_sys.c

index 74c0be2..1bc072d 100644 (file)
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -1275,6 +1275,9 @@ S_doform(pTHX_ CV *cv, GV *gv, OP *retop)
 
     PERL_ARGS_ASSERT_DOFORM;
 
+    if (cv && CvCLONE(cv))
+       cv = MUTABLE_CV(sv_2mortal(MUTABLE_SV(cv_clone(cv))));
+
     ENTER;
     SAVETMPS;
 
@@ -1330,9 +1333,6 @@ PP(pp_enterwrite)
        not_a_format_reference:
        DIE(aTHX_ "Not a format reference");
     }
-    if (CvCLONE(cv))
-       cv = MUTABLE_CV(sv_2mortal(MUTABLE_SV(cv_clone(cv))));
-
     IoFLAGS(io) &= ~IOf_DIDTOP;
     return doform(cv,gv,PL_op->op_next);
 }
@@ -1421,8 +1421,6 @@ PP(pp_leavewrite)
            else
                DIE(aTHX_ "Undefined top format called");
        }
-       if (cv && CvCLONE(cv))
-           cv = MUTABLE_CV(sv_2mortal(MUTABLE_SV(cv_clone(cv))));
        return doform(cv, gv, PL_op);
     }