summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2007-12-20 20:23:45 +0000
committerNicholas Clark <nick@ccl4.org>2007-12-20 20:23:45 +0000
commit78ac7dd9596fbc525d458adec628f7d991dfe43a (patch)
tree06c246ec59c74eb07d3f3c531e209c7ff32ed165 /sv.c
parentac572bf4fde55cf563ae338dfe4e12b22ebc6d80 (diff)
downloadperl-78ac7dd9596fbc525d458adec628f7d991dfe43a.tar.gz
Similiarly Perl_newHV() can become a mathom by making newHV() a
wrapper around newSV_type() and tweaking Perl_sv_upgrade(). p4raw-id: //depot/perl@32676
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/sv.c b/sv.c
index eaaa7260b9..8dfd3ac0c8 100644
--- a/sv.c
+++ b/sv.c
@@ -1260,6 +1260,20 @@ Perl_sv_upgrade(pTHX_ register SV *sv, svtype new_type)
Lets not write to it, in case it confuses a write-back
cache. */
}
+ } else {
+ assert(!SvOK(sv));
+ SvOK_off(sv);
+#ifndef NODEFAULT_SHAREKEYS
+ HvSHAREKEYS_on(sv); /* key-sharing on by default */
+#endif
+ HvMAX(sv) = 7; /* (start with 8 buckets) */
+ if (old_type >= SVt_RV) {
+ HvFILL(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.