[inseparable changes from patch from perl5.003_12 to perl5.003_13]
[p5sagit/p5-mst-13.2.git] / cop.h
diff --git a/cop.h b/cop.h
index bea47c4..299873b 100644 (file)
--- a/cop.h
+++ b/cop.h
@@ -93,6 +93,7 @@ struct block_loop {
     OP *       last_op;
     SV **      itervar;
     SV *       itersave;
+    SV *       iterlval;
     AV *       iterary;
     I32                iterix;
 };
@@ -103,12 +104,14 @@ struct block_loop {
        cx->blk_loop.redo_op = cLOOP->op_redoop;                        \
        cx->blk_loop.next_op = cLOOP->op_nextop;                        \
        cx->blk_loop.last_op = cLOOP->op_lastop;                        \
+       cx->blk_loop.iterlval = Nullsv;                                 \
        cx->blk_loop.itervar = ivar;                                    \
        if (ivar)                                                       \
            cx->blk_loop.itersave = *cx->blk_loop.itervar;
 
 #define POPLOOP(cx)                                                    \
-       newsp           = stack_base + cx->blk_loop.resetsp;
+       newsp           = stack_base + cx->blk_loop.resetsp;            \
+       SvREFCNT_dec(cx->blk_loop.iterlval)
 
 /* context common to subroutines, evals and loops */
 struct block {
@@ -147,7 +150,7 @@ struct block {
        cx->blk_oldretsp        = retstack_ix,                          \
        cx->blk_oldpm           = curpm,                                \
        cx->blk_gimme           = gimme;                                \
-       DEBUG_l( fprintf(stderr,"Entering block %ld, type %s\n",        \
+       DEBUG_l( PerlIO_printf(PerlIO_stderr(), "Entering block %ld, type %s\n",        \
                    (long)cxstack_ix, block_type[t]); )
 
 /* Exit a block (RETURN and LAST). */
@@ -159,7 +162,7 @@ struct block {
        retstack_ix     = cx->blk_oldretsp,                             \
        pm              = cx->blk_oldpm,                                \
        gimme           = cx->blk_gimme;                                \
-       DEBUG_l( fprintf(stderr,"Leaving block %ld, type %s\n",         \
+       DEBUG_l( PerlIO_printf(PerlIO_stderr(), "Leaving block %ld, type %s\n",         \
                    (long)cxstack_ix+1,block_type[cx->cx_type]); )
 
 /* Continue a block elsewhere (NEXT and REDO). */