From: Nicholas Clark Date: Tue, 7 Feb 2006 14:57:36 +0000 (+0000) Subject: pp_pop can be implemented by pp_shift. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=789b4bc932459a2b438f46d8892d9c12f1afe8a1;p=p5sagit%2Fp5-mst-13.2.git pp_pop can be implemented by pp_shift. p4raw-id: //depot/perl@27121 --- diff --git a/mathoms.c b/mathoms.c index f1f20b2..0f0f157 100644 --- a/mathoms.c +++ b/mathoms.c @@ -1049,6 +1049,11 @@ PP(pp_hex) return pp_oct(); } +PP(pp_pop) +{ + return pp_shift(); +} + U8 * Perl_uvuni_to_utf8(pTHX_ U8 *d, UV uv) { diff --git a/opcode.h b/opcode.h index 4541421..adacc4c 100644 --- a/opcode.h +++ b/opcode.h @@ -932,7 +932,7 @@ EXT Perl_ppaddr_t PL_ppaddr[] /* or perlvars.h */ MEMBER_TO_FPTR(Perl_pp_anonhash), MEMBER_TO_FPTR(Perl_pp_splice), MEMBER_TO_FPTR(Perl_pp_push), - MEMBER_TO_FPTR(Perl_pp_pop), + MEMBER_TO_FPTR(Perl_pp_shift), /* Perl_pp_pop */ MEMBER_TO_FPTR(Perl_pp_shift), MEMBER_TO_FPTR(Perl_pp_unshift), MEMBER_TO_FPTR(Perl_pp_sort), diff --git a/opcode.pl b/opcode.pl index b1c50b9..ff171ac 100755 --- a/opcode.pl +++ b/opcode.pl @@ -81,6 +81,7 @@ my @raw_alias = ( Perl_pp_print => ['say'], Perl_pp_index => ['rindex'], Perl_pp_oct => ['hex'], + Perl_pp_shift => ['pop'], ); while (my ($func, $names) = splice @raw_alias, 0, 2) { diff --git a/pp.c b/pp.c index 7789120..1a82a16 100644 --- a/pp.c +++ b/pp.c @@ -4195,24 +4195,12 @@ PP(pp_push) RETURN; } -PP(pp_pop) -{ - dVAR; - dSP; - AV * const av = (AV*)POPs; - SV * const sv = av_pop(av); - if (AvREAL(av)) - (void)sv_2mortal(sv); - PUSHs(sv); - RETURN; -} - PP(pp_shift) { dVAR; dSP; AV * const av = (AV*)POPs; - SV * const sv = av_shift(av); + SV * const sv = PL_op->op_type == OP_SHIFT ? av_shift(av) : av_pop(av); EXTEND(SP, 1); if (!sv) RETPUSHUNDEF;