# endif
#ifdef PERL_CORE
#define space_join_names_mortal S_space_join_names_mortal
+#define tied_handle_method S_tied_handle_method
#endif
#endif
#if defined(PERL_IN_REGCOMP_C) || defined(PERL_DECL_PROT)
# endif
#ifdef PERL_CORE
#define space_join_names_mortal(a) S_space_join_names_mortal(aTHX_ a)
+#define tied_handle_method(a,b,c,d) S_tied_handle_method(aTHX_ a,b,c,d)
#endif
#endif
#if defined(PERL_IN_REGCOMP_C) || defined(PERL_DECL_PROT)
RETURN;
}
+static OP *
+S_tied_handle_method(pTHX_ const char *const methname, SV **sp,
+ IO *const io, MAGIC *const mg)
+{
+ PERL_ARGS_ASSERT_TIED_HANDLE_METHOD;
+
+ PUSHMARK(sp);
+ PUSHs(SvTIED_obj(MUTABLE_SV(io), mg));
+ PUTBACK;
+ ENTER_with_name("call_tied_handle_method");
+ call_method(methname, G_SCALAR);
+ LEAVE_with_name("call_tied_handle_method");
+ return NORMAL;
+}
+
PP(pp_close)
{
dVAR; dSP;
if (io) {
MAGIC * const mg = SvTIED_mg((const SV *)io, PERL_MAGIC_tiedscalar);
if (mg) {
- PUSHMARK(SP);
- PUSHs(SvTIED_obj(MUTABLE_SV(io), mg));
- PUTBACK;
- ENTER_with_name("call_CLOSE");
- call_method("CLOSE", G_SCALAR);
- LEAVE_with_name("call_CLOSE");
- SPAGAIN;
- RETURN;
+ return tied_handle_method("CLOSE", SP, io, mg);
}
}
}
if (gv && (io = GvIO(gv))
&& (mg = SvTIED_mg((const SV *)io, PERL_MAGIC_tiedscalar)))
{
- PUSHMARK(SP);
- PUSHs(SvTIED_obj(MUTABLE_SV(io), mg));
- PUTBACK;
- ENTER_with_name("call_FILENO");
- call_method("FILENO", G_SCALAR);
- LEAVE_with_name("call_FILENO");
- SPAGAIN;
- RETURN;
+ return tied_handle_method("FILENO", SP, io, mg);
}
if (!gv || !(io = GvIO(gv)) || !(fp = IoIFP(io))) {
if (gv && (io = GvIO(gv))) {
MAGIC * const mg = SvTIED_mg((const SV *)io, PERL_MAGIC_tiedscalar);
if (mg) {
- PUSHMARK(SP);
- PUSHs(SvTIED_obj(MUTABLE_SV(io), mg));
- PUTBACK;
- ENTER;
- call_method("TELL", G_SCALAR);
- LEAVE;
- SPAGAIN;
- RETURN;
+ return tied_handle_method("TELL", SP, io, mg);
}
}
else if (!gv) {
#define PERL_ARGS_ASSERT_SPACE_JOIN_NAMES_MORTAL \
assert(array)
+STATIC OP * S_tied_handle_method(pTHX_ const char *const methname, SV **sp, IO *const io, MAGIC *const mg)
+ __attribute__nonnull__(pTHX_1)
+ __attribute__nonnull__(pTHX_2)
+ __attribute__nonnull__(pTHX_3)
+ __attribute__nonnull__(pTHX_4);
+#define PERL_ARGS_ASSERT_TIED_HANDLE_METHOD \
+ assert(methname); assert(sp); assert(io); assert(mg)
+
#endif
#if defined(PERL_IN_REGCOMP_C) || defined(PERL_DECL_PROT)