This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
pp_coreargs: rationalise @_ code
authorDavid Mitchell <davem@iabyn.com>
Thu, 15 Oct 2015 14:39:42 +0000 (15:39 +0100)
committerDavid Mitchell <davem@iabyn.com>
Wed, 3 Feb 2016 08:59:44 +0000 (08:59 +0000)
Make the code in pp_coreargs that cleans up @_ more like the code in
POPSUB, so that the two can eventually be extracted out into a common
macro.

pp.c

diff --git a/pp.c b/pp.c
index 8900706..61b1b29 100644 (file)
--- a/pp.c
+++ b/pp.c
@@ -6444,15 +6444,20 @@ PP(pp_coreargs)
                    this corresponds to the part of POPSUB that
                    does @_ cleanup */
                PERL_CONTEXT *cx = &cxstack[cxstack_ix];
-                AV *av = MUTABLE_AV(PAD_SVl(0));
-               POP_SAVEARRAY();
-               cx->cx_type &= ~ CXp_HASARGS;
-                assert(AvARRAY(MUTABLE_AV(
-                    PadlistARRAY(CvPADLIST(cx->blk_sub.cv))[
-                            CvDEPTH(cx->blk_sub.cv)])) == PL_curpad);
-
-               assert(!AvREAL(av));
-                CLEAR_ARGARRAY(av);
+
+                assert(CxHASARGS(cx));
+                {
+                    AV *av;
+                    assert(AvARRAY(MUTABLE_AV(
+                        PadlistARRAY(CvPADLIST(cx->blk_sub.cv))[
+                                CvDEPTH(cx->blk_sub.cv)])) == PL_curpad);
+                    POP_SAVEARRAY();
+                    av = MUTABLE_AV(PAD_SVl(0));
+                    assert(!AvREAL(av));
+                    CLEAR_ARGARRAY(av);
+                }
+
+               cx->cx_type &= ~CXp_HASARGS;
            }
          }
          break;