summaryrefslogtreecommitdiff
path: root/ext/PerlIO-encoding
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2013-10-04 13:28:58 +0200
committerFather Chrysostomos <sprout@cpan.org>2013-11-22 21:20:37 -0800
commitea35f80112fbe2dfbe7bc30c9804d106145e5241 (patch)
treeab80c56e3208406fd9a36945eabc1bd4196c324c /ext/PerlIO-encoding
parent865e3ae09bd2dde9953a008963d3c5a0ad14e32d (diff)
downloadperl-ea35f80112fbe2dfbe7bc30c9804d106145e5241.tar.gz
Remove redundant SPAGAIN & PUTBACK after PUSHSTACKi().
PUSHSTACKi() calls SWITCHSTACK(), which sets PL_stack_sp and sp like this: sp = PL_stack_sp = PL_stack_base + AvFILLp(t) Hence after PUSHSTACKi() both are identical, so use of SPAGAIN or PUTBACK to assign one to the other is redundant. The use of SPAGAIN in encoding.xs and via.xs was added with commit 24f59afc531955e5 (April 2002) which added the use of PUSHSTACKi(). It feels like cargo-cult. The use of PUTBACK in Perl_amagic_call() predates the introduction of nested stacks and PUSHSTACKi() in commit e336de0d01f30cc4 (April 1998). It dates from perl 5.000, but it's not clear that it was ever needed, as the code in question looked like this, and nothing could have moved the stack between the dSP and PUTBACK: dSP; BINOP myop; SV* res; Zero(&myop, 1, BINOP); myop.op_last = (OP *) &myop; myop.op_next = Nullop; myop.op_flags = OPf_KNOW|OPf_STACKED; ENTER; SAVESPTR(op); op = (OP *) &myop; PUTBACK; The PUTBACK and SPAGAIN in Perl_require_pv() were added by commit d3acc0f7e5197310 (June 1998) which also added the PUSHSTACKi(). They have both been redundant since they were added.
Diffstat (limited to 'ext/PerlIO-encoding')
-rw-r--r--ext/PerlIO-encoding/encoding.pm2
-rw-r--r--ext/PerlIO-encoding/encoding.xs7
2 files changed, 1 insertions, 8 deletions
diff --git a/ext/PerlIO-encoding/encoding.pm b/ext/PerlIO-encoding/encoding.pm
index e2708193c0..e3291a54b0 100644
--- a/ext/PerlIO-encoding/encoding.pm
+++ b/ext/PerlIO-encoding/encoding.pm
@@ -1,7 +1,7 @@
package PerlIO::encoding;
use strict;
-our $VERSION = '0.16';
+our $VERSION = '0.17';
our $DEBUG = 0;
$DEBUG and warn __PACKAGE__, " called by ", join(", ", caller), "\n";
diff --git a/ext/PerlIO-encoding/encoding.xs b/ext/PerlIO-encoding/encoding.xs
index 2d06d821ea..a0415d0ae6 100644
--- a/ext/PerlIO-encoding/encoding.xs
+++ b/ext/PerlIO-encoding/encoding.xs
@@ -60,7 +60,6 @@ PerlIOEncode_getarg(pTHX_ PerlIO * f, CLONE_PARAMS * param, int flags)
dSP;
/* Not 100% sure stack swap is right thing to do during dup ... */
PUSHSTACKi(PERLSI_MAGIC);
- SPAGAIN;
ENTER;
SAVETMPS;
PUSHMARK(sp);
@@ -87,8 +86,6 @@ PerlIOEncode_pushed(pTHX_ PerlIO * f, const char *mode, SV * arg, PerlIO_funcs *
SV *result = Nullsv;
PUSHSTACKi(PERLSI_MAGIC);
- SPAGAIN;
-
ENTER;
SAVETMPS;
@@ -239,7 +236,6 @@ PerlIOEncode_fill(pTHX_ PerlIO * f)
}
}
PUSHSTACKi(PERLSI_MAGIC);
- SPAGAIN;
ENTER;
SAVETMPS;
retry:
@@ -413,7 +409,6 @@ PerlIOEncode_flush(pTHX_ PerlIO * f)
if (e->inEncodeCall) return 0;
/* Write case - encode the buffer and write() to layer below */
PUSHSTACKi(PERLSI_MAGIC);
- SPAGAIN;
ENTER;
SAVETMPS;
PUSHMARK(sp);
@@ -476,7 +471,6 @@ PerlIOEncode_flush(pTHX_ PerlIO * f)
re-encode and unread() to layer below
*/
PUSHSTACKi(PERLSI_MAGIC);
- SPAGAIN;
ENTER;
SAVETMPS;
str = sv_newmortal();
@@ -650,7 +644,6 @@ BOOT:
* is invoked without prior "use Encode". -- dankogai
*/
PUSHSTACKi(PERLSI_MAGIC);
- SPAGAIN;
if (!get_cvs(OUR_DEFAULT_FB, 0)) {
#if 0
/* This would just be an irritant now loading works */