diff options
author | Nicholas Clark <nick@ccl4.org> | 2007-12-20 20:23:45 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2007-12-20 20:23:45 +0000 |
commit | 78ac7dd9596fbc525d458adec628f7d991dfe43a (patch) | |
tree | 06c246ec59c74eb07d3f3c531e209c7ff32ed165 /sv.c | |
parent | ac572bf4fde55cf563ae338dfe4e12b22ebc6d80 (diff) | |
download | perl-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.c | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -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. |