From: Abhijit Menon-Sen Date: Fri, 3 Aug 2001 06:38:11 +0000 (+0530) Subject: newHVhv shouldn't reset xhv_max so often X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4beac62f32147d4a37c16a9084d501a03d4cf981;p=p5sagit%2Fp5-mst-13.2.git newHVhv shouldn't reset xhv_max so often Message-ID: <20010803063811.A19266@lustre.dyn.wiw.org> p4raw-id: //depot/perl@11558 --- diff --git a/hv.c b/hv.c index a08720e..07bccd9 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)) {