From: Vincent Pit Date: Sun, 4 Oct 2009 13:02:56 +0000 (+0200) Subject: Apply the same policy for the value returned by push() and unshift() X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6eeabd23f5b07b262222f010c01eab5c2175cf54;p=p5sagit%2Fp5-mst-13.2.git Apply the same policy for the value returned by push() and unshift() That is, only push the len when the static context is not void, and honour len magic. --- diff --git a/pp.c b/pp.c index fae2d6d..ef7d7ab 100644 --- a/pp.c +++ b/pp.c @@ -4720,10 +4720,6 @@ PP(pp_push) call_method("PUSH",G_SCALAR|G_DISCARD); LEAVE; SPAGAIN; - SP = ORIGMARK; - if (GIMME_V != G_VOID) { - PUSHi( AvFILL(ary) + 1 ); - } } else { PL_delaymagic = DM_DELAY; @@ -4737,10 +4733,10 @@ PP(pp_push) mg_set(MUTABLE_SV(ary)); PL_delaymagic = 0; - SP = ORIGMARK; - if (OP_GIMME(PL_op, 0) != G_VOID) { - PUSHi( AvFILL(ary) + 1 ); - } + } + SP = ORIGMARK; + if (OP_GIMME(PL_op, 0) != G_VOID) { + PUSHi( AvFILL(ary) + 1 ); } RETURN; } @@ -4783,7 +4779,7 @@ PP(pp_unshift) } } SP = ORIGMARK; - if (GIMME_V != G_VOID) { + if (OP_GIMME(PL_op, 0) != G_VOID) { PUSHi( AvFILL(ary) + 1 ); } RETURN;