SV *sv = &PL_sv_undef;
if (e->enc) {
dSP;
+ /* Not 100% sure stack swap is right thing to do during dup ... */
+ PUSHSTACKi(PERLSI_MAGIC);
+ SPAGAIN;
ENTER;
SAVETMPS;
PUSHMARK(sp);
sv = newSVsv(POPs);
PUTBACK;
}
+ FREETMPS;
+ LEAVE;
+ POPSTACK;
}
return sv;
}
IV code = PerlIOBuf_pushed(aTHX_ f, mode, Nullsv);
SV *result = Nullsv;
+ PUSHSTACKi(PERLSI_MAGIC);
+ SPAGAIN;
+
ENTER;
SAVETMPS;
FREETMPS;
LEAVE;
+ POPSTACK;
return code;
}
Perl_die(aTHX_ "panic: cannot push :perlio for %p",f);
}
}
+ PUSHSTACKi(PERLSI_MAGIC);
+ SPAGAIN;
ENTER;
SAVETMPS;
retry:
PerlIO_set_ptrcnt(n, ptr+use, (avail-use));
goto retry;
}
- FREETMPS;
- LEAVE;
- return code;
}
else {
end_of_file:
+ code = -1;
if (avail == 0)
PerlIOBase(f)->flags |= PERLIO_F_EOF;
else
PerlIOBase(f)->flags |= PERLIO_F_ERROR;
- return -1;
}
+ FREETMPS;
+ LEAVE;
+ POPSTACK;
+ return code;
}
IV
SSize_t count = 0;
if (PerlIOBase(f)->flags & PERLIO_F_WRBUF) {
/* Write case encode the buffer and write() to layer below */
+ PUSHSTACKi(PERLSI_MAGIC);
+ SPAGAIN;
ENTER;
SAVETMPS;
PUSHMARK(sp);
}
FREETMPS;
LEAVE;
+ POPSTACK;
if (PerlIO_flush(PerlIONext(f)) != 0) {
code = -1;
}
/* Bother - have unread data.
re-encode and unread() to layer below
*/
+ PUSHSTACKi(PERLSI_MAGIC);
+ SPAGAIN;
ENTER;
SAVETMPS;
str = sv_newmortal();
}
FREETMPS;
LEAVE;
+ POPSTACK;
}
}
e->base.ptr = e->base.end = e->base.buf;
* PerlIO/encoding.pm. This avoids SEGV when ":encoding()"
* is invoked without prior "use Encode". -- dankogai
*/
+ PUSHSTACKi(PERLSI_MAGIC);
+ SPAGAIN;
if (!gv_stashpvn("Encode", 6, FALSE)) {
#if 0
/* This would just be an irritant now loading works */
SPAGAIN;
LEAVE;
}
+#ifdef PERLIO_LAYERS
PUSHMARK(sp);
PUTBACK;
if (call_pv(OUR_DEFAULT_FB, G_SCALAR) != 1) {
SPAGAIN;
sv_setsv(chk, POPs);
PUTBACK;
-#ifdef PERLIO_LAYERS
PerlIO_define_layer(aTHX_ &PerlIO_encode);
#endif
+ POPSTACK;
}