From: Rafael Garcia-Suarez Date: Sat, 3 Jan 2004 00:07:13 +0000 (+0000) Subject: Tidy up change #18751, so that the second parameter to unpack() X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=bab9c0ac4be68b8d3e7a915e21d06ed39d0fa563;p=p5sagit%2Fp5-mst-13.2.git Tidy up change #18751, so that the second parameter to unpack() defaults to $_ at compile-time, instead of run-time (like all other primitives that default to $_). p4raw-link: @18751 on //depot/perl: 13dcffc60adeca175c32a1ea11ec8756d4853ad2 p4raw-id: //depot/perl@22047 --- diff --git a/embed.h b/embed.h index 6386676..e6d51b5 100644 --- a/embed.h +++ b/embed.h @@ -2195,6 +2195,7 @@ #define ck_substr Perl_ck_substr #define ck_svconst Perl_ck_svconst #define ck_trunc Perl_ck_trunc +#define ck_unpack Perl_ck_unpack #define pp_aassign Perl_pp_aassign #define pp_abs Perl_pp_abs #define pp_accept Perl_pp_accept @@ -4687,6 +4688,7 @@ #define ck_substr(a) Perl_ck_substr(aTHX_ a) #define ck_svconst(a) Perl_ck_svconst(aTHX_ a) #define ck_trunc(a) Perl_ck_trunc(aTHX_ a) +#define ck_unpack(a) Perl_ck_unpack(aTHX_ a) #define pp_aassign() Perl_pp_aassign(aTHX) #define pp_abs() Perl_pp_abs(aTHX) #define pp_accept() Perl_pp_accept(aTHX) diff --git a/op.c b/op.c index 806c07f..e0d7f54 100644 --- a/op.c +++ b/op.c @@ -6191,6 +6191,18 @@ Perl_ck_trunc(pTHX_ OP *o) } OP * +Perl_ck_unpack(pTHX_ OP *o) +{ + OP *kid = cLISTOPo->op_first; + if (kid->op_sibling) { + kid = kid->op_sibling; + if (!kid->op_sibling) + kid->op_sibling = newDEFSVOP(); + } + return ck_fun(o); +} + +OP * Perl_ck_substr(pTHX_ OP *o) { o = ck_fun(o); diff --git a/opcode.h b/opcode.h index 4de3dee..5125598 100644 --- a/opcode.h +++ b/opcode.h @@ -1254,7 +1254,7 @@ EXT OP * (CPERLscope(*PL_check)[]) (pTHX_ OP *op) = { MEMBER_TO_FPTR(Perl_ck_rvconst), /* rv2hv */ MEMBER_TO_FPTR(Perl_ck_null), /* helem */ MEMBER_TO_FPTR(Perl_ck_null), /* hslice */ - MEMBER_TO_FPTR(Perl_ck_fun), /* unpack */ + MEMBER_TO_FPTR(Perl_ck_unpack), /* unpack */ MEMBER_TO_FPTR(Perl_ck_fun), /* pack */ MEMBER_TO_FPTR(Perl_ck_split), /* split */ MEMBER_TO_FPTR(Perl_ck_join), /* join */ diff --git a/opcode.pl b/opcode.pl index e13d14d..dc5b66e 100755 --- a/opcode.pl +++ b/opcode.pl @@ -633,7 +633,7 @@ hslice hash slice ck_null m@ H L # Explosives and implosives. -unpack unpack ck_fun @ S S? +unpack unpack ck_unpack @ S S? pack pack ck_fun mst@ S L split split ck_split t@ S S S join join or string ck_join mst@ S L diff --git a/pp.sym b/pp.sym index f2dbb0b..00d4e7e 100644 --- a/pp.sym +++ b/pp.sym @@ -43,6 +43,7 @@ Perl_ck_subr Perl_ck_substr Perl_ck_svconst Perl_ck_trunc +Perl_ck_unpack Perl_pp_null Perl_pp_stub Perl_pp_scalar diff --git a/pp_pack.c b/pp_pack.c index 55469fb..3e4993d 100644 --- a/pp_pack.c +++ b/pp_pack.c @@ -1707,8 +1707,7 @@ S_unpack_rec(pTHX_ register tempsym_t* symptr, register char *s, char *strbeg, c PP(pp_unpack) { dSP; - SV *right = (MAXARG > 1) ? POPs : GvSV(PL_defgv); - SV *left = POPs; + dPOPPOPssrl; I32 gimme = GIMME_V; STRLEN llen; STRLEN rlen; diff --git a/pp_proto.h b/pp_proto.h index 8631194..2f457c3 100644 --- a/pp_proto.h +++ b/pp_proto.h @@ -42,6 +42,7 @@ PERL_CKDEF(Perl_ck_subr) PERL_CKDEF(Perl_ck_substr) PERL_CKDEF(Perl_ck_svconst) PERL_CKDEF(Perl_ck_trunc) +PERL_CKDEF(Perl_ck_unpack) PERL_PPDEF(Perl_pp_null)