summaryrefslogtreecommitdiff
path: root/av.c
diff options
context:
space:
mode:
authorChip Salzenberg <chip@perl.com>1997-03-07 03:46:34 +1200
committerChip Salzenberg <chip@atlantic.net>1997-03-07 04:01:12 +1200
commit29de640a6fb9462a2ad050b90748e4d2fc5f55b9 (patch)
treec2679303e1204a8ec9ecb37950f9143e90dd6440 /av.c
parent1b3374cc62aa03a18646979ac5ddbdd3444d2d14 (diff)
downloadperl-29de640a6fb9462a2ad050b90748e4d2fc5f55b9.tar.gz
Make conversion of @_ to real array work right after C<shift>
Diffstat (limited to 'av.c')
-rw-r--r--av.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/av.c b/av.c
index c7ca844165..9e94805f68 100644
--- a/av.c
+++ b/av.c
@@ -33,6 +33,9 @@ AV* av;
if (sv != &sv_undef)
(void)SvREFCNT_inc(sv);
}
+ key = AvARRAY(av) - AvALLOC(av);
+ while (key)
+ AvALLOC(av)[--key] = &sv_undef;
AvREAL_on(av);
}
@@ -197,10 +200,10 @@ SV *val;
}
if (SvREADONLY(av) && key >= AvFILL(av))
croak(no_modify);
- if (key > AvMAX(av))
- av_extend(av,key);
if (!AvREAL(av) && AvREIFY(av))
av_reify(av);
+ if (key > AvMAX(av))
+ av_extend(av,key);
ary = AvARRAY(av);
if (AvFILL(av) < key) {
if (!AvREAL(av)) {