summaryrefslogtreecommitdiff
path: root/hv.c
diff options
context:
space:
mode:
authorAbhijit Menon-Sen <ams@wiw.org>2001-08-03 12:08:11 +0530
committerJarkko Hietaniemi <jhi@iki.fi>2001-08-03 12:07:58 +0000
commit4beac62f32147d4a37c16a9084d501a03d4cf981 (patch)
tree5a65448be20f8ee95214072019bad4753feb5ddd /hv.c
parentd0c1fe9a9931bc271f3df5ece8307ad9f229999f (diff)
downloadperl-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.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/hv.c b/hv.c
index a08720e849..07bccd9505 100644
--- a/hv.c
+++ b/hv.c
@@ -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)) {