#include "XSUB.h"
+/* a special string address whose value is "isa", but whicb perl knows
+ * to treat as if it were really "DOES" */
+char PL_isa_DOES[] = "isa";
+
bool
Perl_sv_does_sv(pTHX_ SV *sv, SV *namesv, U32 flags)
{
PUSHs(namesv);
PUTBACK;
- methodname = newSVpvs_flags("isa", SVs_TEMP);
- /* ugly hack: use the SvSCREAM flag so S_method_common
- * can figure out we're calling DOES() and not isa(),
- * and report eventual errors correctly. --rgs */
- SvSCREAM_on(methodname);
+ /* create a PV with value "isa", but with a special address
+ * so that perl knows were' realling doing "DOES" instead */
+ methodname = newSV_type(SVt_PV);
+ SvLEN(methodname) = 0;
+ SvCUR(methodname) = strlen(PL_isa_DOES);
+ SvPVX(methodname) = PL_isa_DOES;
+ SvPOK_on(methodname);
+ sv_2mortal(methodname);
call_sv(methodname, G_SCALAR | G_METHOD);
SPAGAIN;
works out the package name and subroutine name from C<cv>, and then calls
C<croak()>. Hence if C<cv> is C<&ouch::awk>, it would call C<croak> as:
- Perl_croak(aTHX_ "Usage: %"SVf"::%"SVf"(%s)", "ouch" "awk",
+ Perl_croak(aTHX_ "Usage: %" SVf "::%" SVf "(%s)", "ouch" "awk",
"eee_yow");
=cut
if (HvNAME_get(stash))
/* diag_listed_as: SKIPME */
- Perl_croak_nocontext("Usage: %"HEKf"::%"HEKf"(%s)",
+ Perl_croak_nocontext("Usage: %" HEKf "::%" HEKf "(%s)",
HEKfARG(HvNAME_HEK(stash)),
HEKfARG(GvNAME_HEK(gv)),
params);
else
/* diag_listed_as: SKIPME */
- Perl_croak_nocontext("Usage: %"HEKf"(%s)",
+ Perl_croak_nocontext("Usage: %" HEKf "(%s)",
HEKfARG(GvNAME_HEK(gv)), params);
} else {
dTHX;
/* Pants. I don't think that it should be possible to get here. */
/* diag_listed_as: SKIPME */
- Perl_croak(aTHX_ "Usage: CODE(0x%"UVxf")(%s)", PTR2UV(cv), params);
+ Perl_croak(aTHX_ "Usage: CODE(0x%" UVxf ")(%s)", PTR2UV(cv), params);
}
}
dXSARGS;
SV * const svz = ST(0);
SV * sv;
- PERL_UNUSED_ARG(cv);
/* [perl #77776] - called as &foo() not foo() */
if (!SvROK(svz))
dXSARGS;
SV * const svz = ST(0);
SV * sv;
- PERL_UNUSED_ARG(cv);
/* [perl #77776] - called as &foo() not foo() */
if (!SvROK(svz) || items != 1)
SV * const svz = ST(0);
SV * sv;
U32 refcnt;
- PERL_UNUSED_ARG(cv);
/* [perl #77776] - called as &foo() not foo() */
if ((items != 1 && items != 2) || !SvROK(svz))
}
+XS(XS_Internals_hv_clear_placehold); /* prototype to pass -Wmissing-prototypes */
+XS(XS_Internals_hv_clear_placehold)
+{
+ dXSARGS;
+
+ if (items != 1 || !SvROK(ST(0)))
+ croak_xs_usage(cv, "hv");
+ else {
+ HV * const hv = MUTABLE_HV(SvRV(ST(0)));
+ hv_clear_placeholders(hv);
+ XSRETURN(0);
+ }
+}
+
XS(XS_PerlIO_get_layers); /* prototype to pass -Wmissing-prototypes */
XS(XS_PerlIO_get_layers)
{
switch (*key) {
case 'i':
- if (klen == 5 && memEQ(key, "input", 5)) {
+ if (memEQs(key, klen, "input")) {
input = SvTRUE(*valp);
break;
}
goto fail;
case 'o':
- if (klen == 6 && memEQ(key, "output", 6)) {
+ if (memEQs(key, klen, "output")) {
input = !SvTRUE(*valp);
break;
}
goto fail;
case 'd':
- if (klen == 7 && memEQ(key, "details", 7)) {
+ if (memEQs(key, klen, "details")) {
details = SvTRUE(*valp);
break;
}
}
else {
if (namok && argok)
- PUSHs(sv_2mortal(Perl_newSVpvf(aTHX_ "%"SVf"(%"SVf")",
+ PUSHs(sv_2mortal(Perl_newSVpvf(aTHX_ "%" SVf "(%" SVf ")",
SVfARG(*namsvp),
SVfARG(*argsvp))));
else if (namok)
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)
{
dXSARGS;
- PERL_UNUSED_VAR(cv);
if (items != 1)
croak_xs_usage(cv, "sv");
} else {
/* Scalar, so use the string that Perl would return */
/* return the pattern in (?msixn:..) format */
-#if PERL_VERSION >= 11
pattern = sv_2mortal(newSVsv(MUTABLE_SV(re)));
-#else
- pattern = newSVpvn_flags(RX_WRAPPED(re), RX_WRAPLEN(re),
- (RX_UTF8(re) ? SVf_UTF8 : 0) | SVs_TEMP);
-#endif
PUSHs(pattern);
XSRETURN(1);
}
{"utf8::unicode_to_native", XS_utf8_unicode_to_native, NULL},
{"Internals::SvREADONLY", XS_Internals_SvREADONLY, "\\[$%@];$"},
{"Internals::SvREFCNT", XS_Internals_SvREFCNT, "\\[$%@];$"},
+ {"Internals::hv_clear_placeholders", XS_Internals_hv_clear_placehold, "\\%"},
{"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, ";$"},