diff options
author | Perl 5 Porters <perl5-porters@africa.nicoh.com> | 1996-08-28 02:44:46 +0000 |
---|---|---|
committer | Andy Dougherty <doughera@lafcol.lafayette.edu> | 1996-08-28 02:44:46 +0000 |
commit | 4dbf434134c769659b99976eaa99777da8a5b38b (patch) | |
tree | 03ff04c61c2d737fe85d693b03030952eb037d76 /av.c | |
parent | bb14ff96c54db23fbbf7447aceb0dda1ce2c24f9 (diff) | |
download | perl-4dbf434134c769659b99976eaa99777da8a5b38b.tar.gz |
random cleanup
This patch removes a few obvious redundancies in the source.
Diffstat (limited to 'av.c')
-rw-r--r-- | av.c | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -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; |