diff options
author | Nicholas Clark <nick@ccl4.org> | 2003-11-01 14:21:38 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2003-11-01 14:21:38 +0000 |
commit | 05619474c45b1f1e16eb70c1d9f8b991a7ad459a (patch) | |
tree | 46af2aa4ec716ae372d688e7ac26d8bae48dddc4 /universal.c | |
parent | 1011f542895f26e864b0395a5884b8095479fed5 (diff) | |
download | perl-05619474c45b1f1e16eb70c1d9f8b991a7ad459a.tar.gz |
Add Internals::HvREHASH to expose the rehashing flag
t/op/hash.t tests that pathological data triggers rehashing
p4raw-id: //depot/perl@21604
Diffstat (limited to 'universal.c')
-rw-r--r-- | universal.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/universal.c b/universal.c index 3a646eab51..9a8ec1b254 100644 --- a/universal.c +++ b/universal.c @@ -188,6 +188,7 @@ XS(XS_Internals_hv_clear_placehold); XS(XS_PerlIO_get_layers); XS(XS_Regexp_DESTROY); XS(XS_Internals_hash_seed); +XS(XS_Internals_HvREHASH); void Perl_boot_core_UNIVERSAL(pTHX) @@ -232,6 +233,7 @@ Perl_boot_core_UNIVERSAL(pTHX) XS_PerlIO_get_layers, file, "*;@"); newXS("Regexp::DESTROY", XS_Regexp_DESTROY, file); newXSproto("Internals::hash_seed",XS_Internals_hash_seed, file, ""); + newXSproto("Internals::HvREHASH", XS_Internals_HvREHASH, file, "\\%"); } @@ -916,3 +918,17 @@ XS(XS_Internals_hash_seed) XSRETURN_UV(PERL_HASH_SEED); } +XS(XS_Internals_HvREHASH) /* Subject to change */ +{ + dXSARGS; + if (SvROK(ST(0))) { + HV *hv = (HV *) SvRV(ST(0)); + if (items == 1 && SvTYPE(hv) == SVt_PVHV) { + if (HvREHASH(hv)) + XSRETURN_YES; + else + XSRETURN_NO; + } + } + Perl_croak(aTHX_ "Internals::HvREHASH $hashref"); +} |