summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/Hash-Util/Util.xs6
-rw-r--r--t/op/coreamp.t1
-rw-r--r--t/op/each.t1
-rw-r--r--t/op/hash.t2
-rw-r--r--t/op/sub_lval.t1
-rw-r--r--universal.c65
6 files changed, 8 insertions, 68 deletions
diff --git a/ext/Hash-Util/Util.xs b/ext/Hash-Util/Util.xs
index 611cc636df..db3fb5ad84 100644
--- a/ext/Hash-Util/Util.xs
+++ b/ext/Hash-Util/Util.xs
@@ -274,7 +274,6 @@ bucket_array(rhv)
XSRETURN(0);
}
-#if PERL_VERSION < 25
SV*
bucket_ratio(rhv)
SV* rhv
@@ -284,7 +283,11 @@ bucket_ratio(rhv)
if (SvROK(rhv)) {
rhv= SvRV(rhv);
if ( SvTYPE(rhv)==SVt_PVHV ) {
+#if PERL_VERSION < 25
SV *ret= Perl_hv_scalar(aTHX_ (HV*)rhv);
+#else
+ SV *ret= Perl_hv_bucket_ratio(aTHX_ (HV*)rhv);
+#endif
ST(0)= ret;
XSRETURN(1);
}
@@ -322,4 +325,3 @@ used_buckets(rhv)
XSRETURN_UNDEF;
}
-#endif
diff --git a/t/op/coreamp.t b/t/op/coreamp.t
index cca23f36b5..5029eab100 100644
--- a/t/op/coreamp.t
+++ b/t/op/coreamp.t
@@ -14,6 +14,7 @@ BEGIN {
$^P |= 0x100;
}
+use Hash::Util;
no warnings 'experimental::smartmatch';
sub lis($$;$) {
diff --git a/t/op/each.t b/t/op/each.t
index 0d342a2f30..f9adc5c2b7 100644
--- a/t/op/each.t
+++ b/t/op/each.t
@@ -5,6 +5,7 @@ BEGIN {
@INC = '../lib';
require './test.pl';
}
+use Hash::Util;
plan tests => 59;
diff --git a/t/op/hash.t b/t/op/hash.t
index 3c083e0281..1e5bc6d8e1 100644
--- a/t/op/hash.t
+++ b/t/op/hash.t
@@ -7,7 +7,7 @@ BEGIN {
}
use strict;
-
+use Hash::Util;
# This will crash perl if it fails
use constant PVBM => 'foo';
diff --git a/t/op/sub_lval.t b/t/op/sub_lval.t
index c94e9f5728..59e286ca6a 100644
--- a/t/op/sub_lval.t
+++ b/t/op/sub_lval.t
@@ -6,6 +6,7 @@ BEGIN {
require './test.pl';
}
plan tests=>211;
+use Hash::Util;
sub a : lvalue { my $a = 34; ${\(bless \$a)} } # Return a temporary
sub b : lvalue { ${\shift} }
diff --git a/universal.c b/universal.c
index f0919b3544..e77fad3605 100644
--- a/universal.c
+++ b/universal.c
@@ -752,68 +752,6 @@ XS(XS_PerlIO_get_layers)
XSRETURN(0);
}
-XS(XS_Hash_Util_bucket_ratio); /* prototype to pass -Wmissing-prototypes */
-XS(XS_Hash_Util_bucket_ratio)
-{
- dXSARGS;
- SV *rhv;
- PERL_UNUSED_VAR(cv);
-
- if (items != 1)
- croak_xs_usage(cv, "hv");
-
- rhv= ST(0);
- if (SvROK(rhv)) {
- rhv= SvRV(rhv);
- if ( SvTYPE(rhv)==SVt_PVHV ) {
- SV *ret= Perl_hv_bucket_ratio(aTHX_ (HV*)rhv);
- ST(0)= ret;
- XSRETURN(1);
- }
- }
- XSRETURN_UNDEF;
-}
-
-XS(XS_Hash_Util_num_buckets); /* prototype to pass -Wmissing-prototypes */
-XS(XS_Hash_Util_num_buckets)
-{
- dXSARGS;
- SV *rhv;
- PERL_UNUSED_VAR(cv);
-
- if (items != 1)
- croak_xs_usage(cv, "hv");
-
- rhv= ST(0);
- if (SvROK(rhv)) {
- rhv= SvRV(rhv);
- if ( SvTYPE(rhv)==SVt_PVHV ) {
- XSRETURN_UV(HvMAX((HV*)rhv)+1);
- }
- }
- XSRETURN_UNDEF;
-}
-
-XS(XS_Hash_Util_used_buckets); /* prototype to pass -Wmissing-prototypes */
-XS(XS_Hash_Util_used_buckets)
-{
- dXSARGS;
- SV *rhv;
- PERL_UNUSED_VAR(cv);
-
- if (items != 1)
- croak_xs_usage(cv, "hv");
-
- rhv= ST(0);
- if (SvROK(rhv)) {
- rhv= SvRV(rhv);
- if ( SvTYPE(rhv)==SVt_PVHV ) {
- XSRETURN_UV(HvFILL((HV*)rhv));
- }
- }
- XSRETURN_UNDEF;
-}
-
XS(XS_re_is_regexp); /* prototype to pass -Wmissing-prototypes */
XS(XS_re_is_regexp)
{
@@ -1066,9 +1004,6 @@ static const struct xsub_details details[] = {
{"Internals::SvREFCNT", XS_Internals_SvREFCNT, "\\[$%@];$"},
{"constant::_make_const", XS_constant__make_const, "\\[$@]"},
{"PerlIO::get_layers", XS_PerlIO_get_layers, "*;@"},
- {"Hash::Util::bucket_ratio", XS_Hash_Util_bucket_ratio, "\\%"},
- {"Hash::Util::num_buckets", XS_Hash_Util_num_buckets, "\\%"},
- {"Hash::Util::used_buckets", XS_Hash_Util_used_buckets, "\\%"},
{"re::is_regexp", XS_re_is_regexp, "$"},
{"re::regname", XS_re_regname, ";$$"},
{"re::regnames", XS_re_regnames, ";$"},