summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2007-12-20 19:49:50 +0000
committerNicholas Clark <nick@ccl4.org>2007-12-20 19:49:50 +0000
commitac572bf4fde55cf563ae338dfe4e12b22ebc6d80 (patch)
treefa0c5697d540c2039ef5fdaeea4f6506ca28199b /sv.c
parent82c0efa4e83781652347e2d8715e3fc7441c39d4 (diff)
downloadperl-ac572bf4fde55cf563ae338dfe4e12b22ebc6d80.tar.gz
Perl_newAV() can become a mathom by making newAV() a wrapper around
newSV_type() and tweaking Perl_sv_upgrade(). p4raw-id: //depot/perl@32675
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/sv.c b/sv.c
index 718e305646..eaaa7260b9 100644
--- a/sv.c
+++ b/sv.c
@@ -1253,6 +1253,13 @@ Perl_sv_upgrade(pTHX_ register SV *sv, svtype new_type)
AvMAX(sv) = -1;
AvFILLp(sv) = -1;
AvREAL_only(sv);
+ if (old_type >= SVt_RV) {
+ AvALLOC(sv) = 0;
+ } else {
+ /* It will have been zeroed when the new body was allocated.
+ Lets not write to it, in case it confuses a write-back
+ cache. */
+ }
}
/* SVt_NULL isn't the only thing upgraded to AV or HV.