summaryrefslogtreecommitdiff
path: root/pp_sys.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2011-01-04 11:54:25 +0000
committerNicholas Clark <nick@ccl4.org>2011-01-04 15:31:18 +0000
commit1a8c1d5954e704d436caa45327fa24044018b01a (patch)
treecf1762c8c93414ac53a0445beeb65dd2e5ddcf23 /pp_sys.c
parent6bcca55b7cefe569c6a05e82b5de2d1eb712c866 (diff)
downloadperl-1a8c1d5954e704d436caa45327fa24044018b01a.tar.gz
Convert tied OPEN to using S_tied_handle_method()
Add a new flag ARGUMENTS_ON_STACK to S_tied_handle_method(), which methods which take a list (OPEN, PRINTF, READ and WRITE) will need.
Diffstat (limited to 'pp_sys.c')
-rw-r--r--pp_sys.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/pp_sys.c b/pp_sys.c
index e0c75e1ab9..d042f590b1 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -511,7 +511,8 @@ PP(pp_die)
Use 0x04 rather than the next available bit, to help the compiler if the
architecture can generate more efficient instructions. */
#define MORTALIZE_NOT_NEEDED 0x04
-#define TIED_HANDLE_ARGC_SHIFT 3
+#define ARGUMENTS_ON_STACK 0x08
+#define TIED_HANDLE_ARGC_SHIFT 4
static OP *
S_tied_handle_method(pTHX_ const char *const methname, SV **sp,
@@ -527,7 +528,9 @@ S_tied_handle_method(pTHX_ const char *const methname, SV **sp,
PUSHMARK(sp);
PUSHs(SvTIED_obj(MUTABLE_SV(io), mg));
- if (argc) {
+ if (flags & ARGUMENTS_ON_STACK)
+ sp += argc;
+ else if (argc) {
const U32 mortalize_not_needed = flags & MORTALIZE_NOT_NEEDED;
va_list args;
va_start(args, flags);
@@ -584,12 +587,9 @@ PP(pp_open)
if (mg) {
/* Method's args are same as ours ... */
/* ... except handle is replaced by the object */
- PUSHMARK(MARK - 1);
- *MARK = SvTIED_obj(MUTABLE_SV(io), mg);
- ENTER_with_name("call_OPEN");
- call_method("OPEN", G_SCALAR);
- LEAVE_with_name("call_OPEN");
- return NORMAL;
+ return S_tied_handle_method(aTHX_ "OPEN", mark - 1, io, mg,
+ G_SCALAR | ARGUMENTS_ON_STACK
+ | (sp - mark) << TIED_HANDLE_ARGC_SHIFT);
}
}