In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/1186f82119d5270455d8831744d4f40a4ccbb222?hp=c9470cf1abc4cc21f63ba5222f7860ec1175adfc>
- Log ----------------------------------------------------------------- commit 1186f82119d5270455d8831744d4f40a4ccbb222 Author: Steffen Mueller <[email protected]> Date: Fri Feb 3 09:06:41 2017 +0100 HvTOTALKEYS() takes a HV* as argument Incidentally, it currently works on SV *'s as well because there's an explicit cast after an SvANY. Let's not rely on that. This commit also removes a pointless const in a cast. Again. It takes an HV * as argument. Let's only change that if we have a strong reason to. ----------------------------------------------------------------------- Summary of changes: dump.c | 2 +- hv.c | 2 +- hv.h | 2 +- pp_hot.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dump.c b/dump.c index 9eb26bcc94..52b52cab08 100644 --- a/dump.c +++ b/dump.c @@ -1892,7 +1892,7 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo (UV)aux->xhv_aux_flags); } Perl_dump_indent(aTHX_ level, file, " ARRAY = 0x%" UVxf, PTR2UV(HvARRAY(sv))); - usedkeys = HvUSEDKEYS(sv); + usedkeys = HvUSEDKEYS(MUTABLE_HV(sv)); if (HvARRAY(sv) && usedkeys) { /* Show distribution of HEs in the ARRAY */ int freq[200]; diff --git a/hv.c b/hv.c index e9d5375da4..efeadb7dad 100644 --- a/hv.c +++ b/hv.c @@ -990,7 +990,7 @@ Perl_hv_bucket_ratio(pTHX_ HV *hv) } sv = sv_newmortal(); - if (HvUSEDKEYS((const HV *)hv)) + if (HvUSEDKEYS((HV *)hv)) Perl_sv_setpvf(aTHX_ sv, "%ld/%ld", (long)HvFILL(hv), (long)HvMAX(hv) + 1); else diff --git a/hv.h b/hv.h index b6b22dfd76..8411b5d31f 100644 --- a/hv.h +++ b/hv.h @@ -325,7 +325,7 @@ C<SV*>. ((SvOOK(hv) && HvAUX(hv)->xhv_name_u.xhvnameu_name && HvAUX(hv)->xhv_name_count != -1) \ ? HEK_UTF8(HvENAME_HEK_NN(hv)) : 0) -/* the number of keys (including any placeholders) */ +/* the number of keys (including any placeholders) - NOT PART OF THE API */ #define XHvTOTALKEYS(xhv) ((xhv)->xhv_keys) /* diff --git a/pp_hot.c b/pp_hot.c index aeaecfc3df..a3ee2a7390 100644 --- a/pp_hot.c +++ b/pp_hot.c @@ -1039,7 +1039,7 @@ PP(pp_rv2av) || ( PL_op->op_private & OPpMAYBE_TRUEBOOL && block_gimme() == G_VOID )) && (!SvRMAGICAL(sv) || !mg_find(sv, PERL_MAGIC_tied))) - SETs(HvUSEDKEYS(sv) ? &PL_sv_yes : &PL_sv_no); + SETs(HvUSEDKEYS(MUTABLE_HV(sv)) ? &PL_sv_yes : &PL_sv_no); else if (gimme == G_SCALAR) { dTARG; TARG = Perl_hv_scalar(aTHX_ MUTABLE_HV(sv)); -- Perl5 Master Repository
