From: Nicholas Clark Date: Sun, 24 Jan 2010 10:50:02 +0000 (+0000) Subject: Replace boolean use of HvFILL(hv) with HvTOTALKEYS(hv), which is equivalent. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f4431c56525a8650559872ff19c75f109a5d1190;p=p5sagit%2Fp5-mst-13.2.git Replace boolean use of HvFILL(hv) with HvTOTALKEYS(hv), which is equivalent. --- diff --git a/hv.c b/hv.c index 89c6456..c7ca826 100644 --- a/hv.c +++ b/hv.c @@ -887,7 +887,7 @@ Perl_hv_scalar(pTHX_ HV *hv) } sv = sv_newmortal(); - if (HvFILL((const HV *)hv)) + if (HvTOTALKEYS((const HV *)hv)) Perl_sv_setpvf(aTHX_ sv, "%ld/%ld", (long)HvFILL(hv), (long)HvMAX(hv) + 1); else @@ -1317,7 +1317,7 @@ Perl_hv_ksplit(pTHX_ HV *hv, IV newmax) } xhv->xhv_max = --newsize; /* HvMAX(hv) = --newsize */ HvARRAY(hv) = (HE **) a; - if (!xhv->xhv_fill /* !HvFILL(hv) */) /* skip rest if no entries */ + if (!xhv->xhv_keys /* !HvTOTALKEYS(hv) */) /* skip rest if no entries */ return; aep = (HE**)a; @@ -1348,9 +1348,9 @@ Perl_newHVhv(pTHX_ HV *ohv) { dVAR; HV * const hv = newHV(); - STRLEN hv_max, hv_fill; + STRLEN hv_max; - if (!ohv || (hv_fill = HvFILL(ohv)) == 0) + if (!ohv || !HvTOTALKEYS(ohv)) return hv; hv_max = HvMAX(ohv); @@ -1396,7 +1396,7 @@ Perl_newHVhv(pTHX_ HV *ohv) } HvMAX(hv) = hv_max; - HvFILL(hv) = hv_fill; + HvFILL(hv) = HvFILL(ohv); HvTOTALKEYS(hv) = HvTOTALKEYS(ohv); HvARRAY(hv) = ents; } /* not magical */ @@ -1405,6 +1405,7 @@ Perl_newHVhv(pTHX_ HV *ohv) HE *entry; const I32 riter = HvRITER_get(ohv); HE * const eiter = HvEITER_get(ohv); + STRLEN hv_fill = HvFILL(ohv); /* Can we use fewer buckets? (hv_max is always 2^n-1) */ while (hv_max && hv_max + 1 >= hv_fill * 2) @@ -1431,10 +1432,10 @@ HV * Perl_hv_copy_hints_hv(pTHX_ HV *const ohv) { HV * const hv = newHV(); - STRLEN hv_fill; - if (ohv && (hv_fill = HvFILL(ohv))) { + if (ohv && HvTOTALKEYS(ohv)) { STRLEN hv_max = HvMAX(ohv); + STRLEN hv_fill = HvFILL(ohv); HE *entry; const I32 riter = HvRITER_get(ohv); HE * const eiter = HvEITER_get(ohv); diff --git a/op.c b/op.c index ecc8b88..3edb122 100644 --- a/op.c +++ b/op.c @@ -5921,7 +5921,7 @@ Perl_newATTRSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block) (void)hv_store(GvHV(PL_DBsub), SvPVX_const(tmpstr), SvCUR(tmpstr), sv, 0); hv = GvHVn(db_postponed); - if (HvFILL(hv) > 0 && hv_exists(hv, SvPVX_const(tmpstr), SvCUR(tmpstr))) { + if (HvTOTALKEYS(hv) > 0 && hv_exists(hv, SvPVX_const(tmpstr), SvCUR(tmpstr))) { CV * const pcv = GvCV(db_postponed); if (pcv) { dSP;