summaryrefslogtreecommitdiff
path: root/av.c
diff options
context:
space:
mode:
authorMalcolm Beattie <mbeattie@sable.ox.ac.uk>1997-10-08 10:19:27 +0000
committerMalcolm Beattie <mbeattie@sable.ox.ac.uk>1997-10-08 10:19:27 +0000
commit93af7a870f71dbbb13443b4087703de0221add17 (patch)
treee767c53d4d4f1783640e5410f94655e45b58b3d0 /av.c
parentc116a00cf797ec2e6795338ee18b88d975e760c5 (diff)
parent2269e8ecc334a5a77bdb915666547431c0171402 (diff)
downloadperl-93af7a870f71dbbb13443b4087703de0221add17.tar.gz
Merge maint-5.004 branch (5.004_03) with mainline.
MANIFEST is out of sync. p4raw-id: //depot/perl@114
Diffstat (limited to 'av.c')
-rw-r--r--av.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/av.c b/av.c
index 86232216ec..b583f7ed6d 100644
--- a/av.c
+++ b/av.c
@@ -256,17 +256,19 @@ register SV **strp;
av = (AV*)NEWSV(8,0);
sv_upgrade((SV *) av,SVt_PVAV);
- New(4,ary,size+1,SV*);
- AvALLOC(av) = ary;
AvFLAGS(av) = AVf_REAL;
- SvPVX(av) = (char*)ary;
- AvFILL(av) = size - 1;
- AvMAX(av) = size - 1;
- for (i = 0; i < size; i++) {
- assert (*strp);
- ary[i] = NEWSV(7,0);
- sv_setsv(ary[i], *strp);
- strp++;
+ if (size) { /* `defined' was returning undef for size==0 anyway. */
+ New(4,ary,size,SV*);
+ AvALLOC(av) = ary;
+ SvPVX(av) = (char*)ary;
+ AvFILL(av) = size - 1;
+ AvMAX(av) = size - 1;
+ for (i = 0; i < size; i++) {
+ assert (*strp);
+ ary[i] = NEWSV(7,0);
+ sv_setsv(ary[i], *strp);
+ strp++;
+ }
}
return av;
}