summaryrefslogtreecommitdiff
path: root/pp_sys.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2010-12-27 19:11:26 +0000
committerNicholas Clark <nick@ccl4.org>2010-12-27 19:11:26 +0000
commit5616b3e5c33b0e0c06d994847fac886994061215 (patch)
tree198ab114f441659e6fe48487fd2ca19d9b0469d7 /pp_sys.c
parent0a0e3cc51ec8fc6df32f39441333d8462b0fbd30 (diff)
downloadperl-5616b3e5c33b0e0c06d994847fac886994061215.tar.gz
Simplify return handling for tied handle OPEN/PRINTF/READ/WRITE.
Their code used to explicitly move the return value from its current position on the stack, to the position that was top of top of the stack just before the call was made. However, the POPBLOCK() in pp_leavesub will restore the stack pointer, and passing G_SCALAR to call_method() will force exactly one return value, so all of this is needless defensiveness.
Diffstat (limited to 'pp_sys.c')
-rw-r--r--pp_sys.c27
1 files changed, 5 insertions, 22 deletions
diff --git a/pp_sys.c b/pp_sys.c
index d54b44efea..3f43e495a1 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -527,8 +527,7 @@ PP(pp_open)
ENTER_with_name("call_OPEN");
call_method("OPEN", G_SCALAR);
LEAVE_with_name("call_OPEN");
- SPAGAIN;
- RETURN;
+ return NORMAL;
}
}
@@ -1506,11 +1505,7 @@ PP(pp_prtf)
ENTER;
call_method("PRINTF", G_SCALAR);
LEAVE;
- SPAGAIN;
- MARK = ORIGMARK + 1;
- *MARK = *SP;
- SP = MARK;
- RETURN;
+ return NORMAL;
}
}
@@ -1603,17 +1598,12 @@ PP(pp_sysread)
{
const MAGIC * mg = SvTIED_mg((const SV *)io, PERL_MAGIC_tiedscalar);
if (mg) {
- SV *sv;
PUSHMARK(MARK-1);
*MARK = SvTIED_obj(MUTABLE_SV(io), mg);
ENTER;
call_method("READ", G_SCALAR);
LEAVE;
- SPAGAIN;
- sv = POPs;
- SP = ORIGMARK;
- PUSHs(sv);
- RETURN;
+ return NORMAL;
}
}
@@ -1851,11 +1841,8 @@ PP(pp_send)
&& gv && (io = GvIO(gv))) {
MAGIC * const mg = SvTIED_mg((const SV *)io, PERL_MAGIC_tiedscalar);
if (mg) {
- SV *sv;
-
if (MARK == SP - 1) {
- sv = *SP;
- mXPUSHi(sv_len(sv));
+ mXPUSHi(sv_len(*SP));
PUTBACK;
}
@@ -1864,11 +1851,7 @@ PP(pp_send)
ENTER;
call_method("WRITE", G_SCALAR);
LEAVE;
- SPAGAIN;
- sv = POPs;
- SP = ORIGMARK;
- PUSHs(sv);
- RETURN;
+ return NORMAL;
}
}
if (!gv)