summaryrefslogtreecommitdiff
path: root/av.c
diff options
context:
space:
mode:
authorPerl 5 Porters <perl5-porters@africa.nicoh.com>1996-08-28 02:44:46 +0000
committerAndy Dougherty <doughera@lafcol.lafayette.edu>1996-08-28 02:44:46 +0000
commit4dbf434134c769659b99976eaa99777da8a5b38b (patch)
tree03ff04c61c2d737fe85d693b03030952eb037d76 /av.c
parentbb14ff96c54db23fbbf7447aceb0dda1ce2c24f9 (diff)
downloadperl-4dbf434134c769659b99976eaa99777da8a5b38b.tar.gz
random cleanup
This patch removes a few obvious redundancies in the source.
Diffstat (limited to 'av.c')
-rw-r--r--av.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/av.c b/av.c
index dfd25df760..cad6eaeac4 100644
--- a/av.c
+++ b/av.c
@@ -153,12 +153,19 @@ I32 lval;
return av_store(av,key,sv);
}
if (AvARRAY(av)[key] == &sv_undef) {
+ emptyness:
if (lval) {
sv = NEWSV(6,0);
return av_store(av,key,sv);
}
return 0;
}
+ else if (AvREIFY(av)
+ && (!AvARRAY(av)[key] /* eg. @_ could have freed elts */
+ || SvTYPE(AvARRAY(av)[key]) == SVTYPEMASK)) {
+ AvARRAY(av)[key] = &sv_undef; /* 1/2 reify */
+ goto emptyness;
+ }
return &AvARRAY(av)[key];
}
@@ -327,10 +334,6 @@ register AV *av;
while (key)
SvREFCNT_dec(AvARRAY(av)[--key]);
}
- if (key = AvARRAY(av) - AvALLOC(av)) {
- AvMAX(av) += key;
- SvPVX(av) = (char*)AvALLOC(av);
- }
Safefree(AvALLOC(av));
AvALLOC(av) = 0;
SvPVX(av) = 0;