Tidy up change #18751, so that the second parameter to unpack()
Rafael Garcia-Suarez [Sat, 3 Jan 2004 00:07:13 +0000 (00:07 +0000)]
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

embed.h
op.c
opcode.h
opcode.pl
pp.sym
pp_pack.c
pp_proto.h

diff --git a/embed.h b/embed.h
index 6386676..e6d51b5 100644 (file)
--- a/embed.h
+++ b/embed.h
 #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
 #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 (file)
--- 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);
index 4de3dee..5125598 100644 (file)
--- 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 */
index e13d14d..dc5b66e 100755 (executable)
--- 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 (file)
--- 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
index 55469fb..3e4993d 100644 (file)
--- 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;
index 8631194..2f457c3 100644 (file)
@@ -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)