dSP; dTARGET;
PerlIO *fp;
STRLEN n_a;
- char *tmps = POPpx;
+ const char *tmps = POPpconstx;
const I32 gimme = GIMME_V;
const char *mode = "r";
mode = "rb";
else if (PL_op->op_private & OPpOPEN_IN_CRLF)
mode = "rt";
- fp = PerlProc_popen(tmps, (char *)mode);
+ fp = PerlProc_popen((char*)tmps, (char *)mode);
if (fp) {
const char *type = NULL;
if (PL_curcop->cop_io) {
tmps = SvPV(tmpsv, len);
if ((!tmps || !len) && PL_errgv) {
SV *error = ERRSV;
- (void)SvUPGRADE(error, SVt_PV);
+ SvUPGRADE(error, SVt_PV);
if (SvPOK(error) && SvCUR(error))
sv_catpv(error, "\t...caught");
tmpsv = error;
dTARGET;
do_join(TARG, &PL_sv_no, MARK, SP);
tmpsv = TARG;
- tmps = SvPV(tmpsv, len);
+ tmps = SvPV_const(tmpsv, len);
multiarg = 1;
SP = MARK + 1;
}
else {
tmpsv = TOPs;
- tmps = SvROK(tmpsv) ? Nullch : SvPV(tmpsv, len);
+ tmps = SvROK(tmpsv) ? Nullch : SvPV_const(tmpsv, len);
}
if (!tmps || !len) {
SV *error = ERRSV;
- (void)SvUPGRADE(error, SVt_PV);
+ SvUPGRADE(error, SVt_PV);
if (multiarg ? SvROK(error) : SvROK(tmpsv)) {
if (!multiarg)
SvSetSV(error,tmpsv);
GV *gv;
SV *sv;
IO *io;
- char *tmps;
+ const char *tmps;
STRLEN len;
MAGIC *mg;
bool ok;
sv = GvSV(gv);
}
- tmps = SvPV(sv, len);
- ok = do_openn(gv, tmps, len, FALSE, O_RDONLY, 0, Nullfp, MARK+1, (SP-MARK));
+ tmps = SvPV_const(sv, len);
+ ok = do_openn(gv, (char *)tmps, len, FALSE, O_RDONLY, 0, Nullfp, MARK+1, (SP-MARK));
SP = ORIGMARK;
if (ok)
PUSHi( (I32)PL_forkprocess );
cv = GvFORM(fgv);
if (!cv) {
SV * const sv = sv_newmortal();
- char *name;
+ const char *name;
gv_efullname4(sv, fgv, Nullch, FALSE);
name = SvPV_nolen(sv);
if (name && *name)
SvCUR_set(bufsv, offset);
read_target = sv_newmortal();
- (void)SvUPGRADE(read_target, SVt_PV);
+ SvUPGRADE(read_target, SVt_PV);
buffer = SvGROW(read_target, (STRLEN)(length + 1));
}
"lstat() on filehandle %s", GvENAME(gv));
goto do_fstat;
}
- sv_setpv(PL_statname, SvPV(sv,n_a));
+ sv_setpv(PL_statname, SvPV_const(sv,n_a));
PL_statgv = Nullgv;
PL_laststype = PL_op->op_type;
if (PL_op->op_type == OP_LSTAT)
PP(pp_chdir)
{
dSP; dTARGET;
- char *tmps;
+ const char *tmps;
SV **svp;
STRLEN n_a;
if( MAXARG == 1 )
- tmps = POPpx;
+ tmps = POPpconstx;
else
tmps = 0;
{
if( MAXARG == 1 )
deprecate("chdir('') or chdir(undef) as chdir()");
- tmps = SvPV(*svp, n_a);
+ tmps = SvPV_const(*svp, n_a);
}
else {
PUSHi(0);
#if !defined(HAS_MKDIR) || !defined(HAS_RMDIR)
STATIC int
-S_dooneliner(pTHX_ char *cmd, char *filename)
+S_dooneliner(pTHX_ const char *cmd, const char *filename)
{
- char *save_filename = filename;
+ char * const save_filename = filename;
char *cmdline;
char *s;
PerlIO *myfp;
* -d, chdir(), chmod(), chown(), chroot(), fcntl()?,
* (mkdir()), opendir(), rename(), rmdir(), stat(). --jhi */
-#define TRIMSLASHES(tmps,len,copy) (tmps) = SvPV(TOPs, (len)); \
+#define TRIMSLASHES(tmps,len,copy) (tmps) = SvPV_const(TOPs, (len)); \
if ((len) > 1 && (tmps)[(len)-1] == '/') { \
do { \
(len)--; \
int oldumask;
#endif
STRLEN len;
- char *tmps;
+ const char *tmps;
bool copy = FALSE;
if (MAXARG > 1)
{
dSP; dTARGET;
STRLEN len;
- char *tmps;
+ const char *tmps;
bool copy = FALSE;
TRIMSLASHES(tmps,len,copy);
#ifdef HAS_GETPPID
dSP; dTARGET;
# ifdef THREADS_HAVE_PIDS
- {
- IV cur_ppid = getppid();
- if (cur_ppid == 1)
- /* maybe the parent process has died. Refresh ppid cache */
- PL_ppid = cur_ppid;
- }
+ if (PL_ppid != 1 && getppid() == 1)
+ /* maybe the parent process has died. Refresh ppid cache */
+ PL_ppid = 1;
XPUSHi( PL_ppid );
# else
XPUSHi( getppid() );