This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
POPLOOP(): no need to mortalise current item
authorDavid Mitchell <davem@iabyn.com>
Thu, 27 Aug 2015 12:40:20 +0000 (13:40 +0100)
committerDavid Mitchell <davem@iabyn.com>
Wed, 3 Feb 2016 08:59:39 +0000 (08:59 +0000)
Now that pp_return() protects its return arg(s) against premature freeing
before calling dounwind(), there's no need for POPLOOP to mortalise the
current item.

cop.h

diff --git a/cop.h b/cop.h
index e430201..5cf5a30 100644 (file)
--- a/cop.h
+++ b/cop.h
@@ -845,8 +845,7 @@ struct block_loop {
                 cursv = *svp;                                           \
                 *svp = cx->blk_loop.itersave;                           \
             }                                                           \
-            /* delayed rc-- in case of "for $x (...) { return $x }" */  \
-            sv_2mortal(cursv);                                          \
+            SvREFCNT_dec(cursv);                                        \
         }                                                               \
 
 /* given/when context */