diff options
author | Abhijit Menon-Sen <ams@wiw.org> | 2001-08-03 12:08:11 +0530 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-08-03 12:07:58 +0000 |
commit | 4beac62f32147d4a37c16a9084d501a03d4cf981 (patch) | |
tree | 5a65448be20f8ee95214072019bad4753feb5ddd /hv.c | |
parent | d0c1fe9a9931bc271f3df5ece8307ad9f229999f (diff) | |
download | perl-4beac62f32147d4a37c16a9084d501a03d4cf981.tar.gz |
newHVhv shouldn't reset xhv_max so often
Message-ID: <20010803063811.A19266@lustre.dyn.wiw.org>
p4raw-id: //depot/perl@11558
Diffstat (limited to 'hv.c')
-rw-r--r-- | hv.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -1180,16 +1180,16 @@ Perl_newHV(pTHX) HV * Perl_newHVhv(pTHX_ HV *ohv) { - register HV *hv; - STRLEN hv_max = ohv ? HvMAX(ohv) : 0; - STRLEN hv_fill = ohv ? HvFILL(ohv) : 0; + STRLEN hv_max, hv_fill; + register HV *hv = newHV(); + + if (!ohv || (hv_fill = HvFILL(ohv)) == 0) + return hv; - hv = newHV(); + hv_max = HvMAX(ohv); while (hv_max && hv_max + 1 >= hv_fill * 2) hv_max = hv_max / 2; /* Is always 2^n-1 */ HvMAX(hv) = hv_max; - if (!hv_fill) - return hv; #if 0 if (! SvTIED_mg((SV*)ohv, PERL_MAGIC_tied)) { |