This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
give POP_SAVEARRAY() macro a cx arg
authorDavid Mitchell <davem@iabyn.com>
Fri, 18 Dec 2015 22:09:58 +0000 (22:09 +0000)
committerDavid Mitchell <davem@iabyn.com>
Wed, 3 Feb 2016 09:18:36 +0000 (09:18 +0000)
rather than just assuming that there's a 'cx' var in scope

cop.h
pp_ctl.c

diff --git a/cop.h b/cop.h
index 347e20e..ef86f4f 100644 (file)
--- a/cop.h
+++ b/cop.h
@@ -647,7 +647,7 @@ struct block_format {
        SvREFCNT_inc_void(cx->blk_format.dfoutgv)
 
 /* Restore old @_ */
        SvREFCNT_inc_void(cx->blk_format.dfoutgv)
 
 /* Restore old @_ */
-#define POP_SAVEARRAY()                                                \
+#define POP_SAVEARRAY(cx)                                              \
     STMT_START {                                                       \
         AV *av = GvAV(PL_defgv);                                        \
        GvAV(PL_defgv) = cx->blk_sub.savearray;                         \
     STMT_START {                                                       \
         AV *av = GvAV(PL_defgv);                                        \
        GvAV(PL_defgv) = cx->blk_sub.savearray;                         \
@@ -686,7 +686,7 @@ struct block_format {
         assert(AvARRAY(MUTABLE_AV(                                      \
             PadlistARRAY(CvPADLIST(cx->blk_sub.cv))[                    \
                     CvDEPTH(cx->blk_sub.cv)])) == PL_curpad);           \
         assert(AvARRAY(MUTABLE_AV(                                      \
             PadlistARRAY(CvPADLIST(cx->blk_sub.cv))[                    \
                     CvDEPTH(cx->blk_sub.cv)])) == PL_curpad);           \
-        POP_SAVEARRAY();                                               \
+        POP_SAVEARRAY(cx);                                             \
         av = MUTABLE_AV(PAD_SVl(0));                                    \
         if (UNLIKELY(AvREAL(av)))                                      \
             /* abandon @_ if it got reified */                         \
         av = MUTABLE_AV(PAD_SVl(0));                                    \
         if (UNLIKELY(AvREAL(av)))                                      \
             /* abandon @_ if it got reified */                         \
index 735969c..bc8b778 100644 (file)
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -2796,7 +2796,7 @@ PP(pp_goto)
                SP += items;
                if (CxTYPE(cx) == CXt_SUB && CxHASARGS(cx)) {
                    /* Restore old @_ */
                SP += items;
                if (CxTYPE(cx) == CXt_SUB && CxHASARGS(cx)) {
                    /* Restore old @_ */
-                    POP_SAVEARRAY();
+                    POP_SAVEARRAY(cx);
                }
 
                retop = cx->blk_sub.retop;
                }
 
                retop = cx->blk_sub.retop;