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 we're really doing "DOES" instead */
+ methodname = newSV_type(SVt_PV);
+ SvLEN_set(methodname, 0);
+ SvCUR_set(methodname, strlen(PL_isa_DOES));
+ SvPVX(methodname) = (char *)PL_isa_DOES; /* discard 'const' qualifier */
+ SvPOK_on(methodname);
+ sv_2mortal(methodname);
call_sv(methodname, G_SCALAR | G_METHOD);
SPAGAIN;
- does_it = SvTRUE( TOPs );
+ does_it = SvTRUE_NN( TOPs );
FREETMPS;
LEAVE;
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);
}
}
if (items < 1 || items > 2)
croak_xs_usage(cv, "sv, failok=0");
else {
- SV * const sv = ST(0);
- const bool failok = (items < 2) ? 0 : SvTRUE(ST(1)) ? 1 : 0;
- const bool RETVAL = sv_utf8_downgrade(sv, failok);
+ SV * const sv0 = ST(0);
+ SV * const sv1 = ST(1);
+ const bool failok = (items < 2) ? 0 : SvTRUE_NN(sv1) ? 1 : 0;
+ const bool RETVAL = sv_utf8_downgrade(sv0, failok);
ST(0) = boolSV(RETVAL);
}
dXSARGS;
SV * const svz = ST(0);
SV * sv;
- PERL_UNUSED_ARG(cv);
/* [perl #77776] - called as &foo() not foo() */
if (!SvROK(svz))
XSRETURN_NO;
}
else if (items == 2) {
- if (SvTRUE(ST(1))) {
+ SV *sv1 = ST(1);
+ if (SvTRUE_NN(sv1)) {
SvFLAGS(sv) |= SVf_READONLY;
XSRETURN_YES;
}
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))
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)
XS(XS_re_is_regexp)
{
dXSARGS;
- PERL_UNUSED_VAR(cv);
if (items != 1)
croak_xs_usage(cv, "sv");
if (!rx)
XSRETURN_UNDEF;
- if (items == 2 && SvTRUE(ST(1))) {
+ if (items == 2 && SvTRUE_NN(ST(1))) {
flags = RXapif_ALL;
} else {
flags = RXapif_ONE;
if (!rx)
XSRETURN_UNDEF;
- if (items == 1 && SvTRUE(ST(0))) {
+ if (items == 1 && SvTRUE_NN(ST(0))) {
flags = RXapif_ALL;
} else {
flags = RXapif_ONE;
} 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);
}
NOT_REACHED; /* NOTREACHED */
}
+#ifdef HAS_GETCWD
+
+XS(XS_Internals_getcwd)
+{
+ dXSARGS;
+ SV *sv = sv_newmortal();
+
+ if (items != 0)
+ croak_xs_usage(cv, "");
+
+ (void)getcwd_sv(sv);
+
+ SvTAINTED_on(sv);
+ PUSHs(sv);
+ XSRETURN(1);
+}
+
+#endif
+
#include "vutil.h"
#include "vxs.inc"
const char *proto;
};
-static const struct xsub_details details[] = {
+static const struct xsub_details these_details[] = {
{"UNIVERSAL::isa", XS_UNIVERSAL_isa, NULL},
{"UNIVERSAL::can", XS_UNIVERSAL_can, NULL},
{"UNIVERSAL::DOES", XS_UNIVERSAL_DOES, NULL},
{"re::regnames", XS_re_regnames, ";$"},
{"re::regnames_count", XS_re_regnames_count, ""},
{"re::regexp_pattern", XS_re_regexp_pattern, "$"},
+#ifdef HAS_GETCWD
+ {"Internals::getcwd", XS_Internals_getcwd, ""},
+#endif
};
STATIC OP*
Perl_boot_core_UNIVERSAL(pTHX)
{
static const char file[] = __FILE__;
- const struct xsub_details *xsub = details;
- const struct xsub_details *end = C_ARRAY_END(details);
+ const struct xsub_details *xsub = these_details;
+ const struct xsub_details *end = C_ARRAY_END(these_details);
do {
newXS_flags(xsub->name, xsub->xsub, file, xsub->proto, 0);
CV* to_native_cv = get_cv("utf8::unicode_to_native", 0);
CV* to_unicode_cv = get_cv("utf8::native_to_unicode", 0);
- cv_set_call_checker(to_native_cv,
+ cv_set_call_checker_flags(to_native_cv,
optimize_out_native_convert_function,
- (SV*) to_native_cv);
- cv_set_call_checker(to_unicode_cv,
+ (SV*) to_native_cv, 0);
+ cv_set_call_checker_flags(to_unicode_cv,
optimize_out_native_convert_function,
- (SV*) to_unicode_cv);
+ (SV*) to_unicode_cv, 0);
}
#endif