This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
eliminate weird gimme calc in pp_leave()
authorDavid Mitchell <davem@iabyn.com>
Sat, 10 Oct 2015 22:41:15 +0000 (23:41 +0100)
committerDavid Mitchell <davem@iabyn.com>
Wed, 3 Feb 2016 08:59:41 +0000 (08:59 +0000)
Some code in pp_leave that's been around in one form or another since
5.000, calculates the value of gimme in a complicated way, rather than
just using the saved value in the current context, like all the other
pp_leave* functions do.

I think this code is redundant; running the test suite with an assert that
the extra calculation doesn't change anything, doesn't produce any failures.
So out it goes.

(In particular. cxstack_ix can never be < 0 here.)

pp_ctl.c

index 796ee4c..ebc5c71 100644 (file)
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -2091,7 +2091,6 @@ PP(pp_leave)
     assert(CxTYPE(cx) == CXt_BLOCK);
     newsp = PL_stack_base + cx->blk_oldsp;
     gimme = cx->blk_gimme;
-    gimme = OP_GIMME(PL_op, (cxstack_ix >= 0) ? gimme : G_SCALAR);
 
     SP = (gimme == G_VOID)
         ? newsp