X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pp_ctl.c;h=2a10ab056dcca3b111f0c83097b38f4808a14af8;hb=aec46f14fac1bc74bf8ad4054a6f9674b324f8d2;hp=d39d3560f68e8c7d8d7dfe912c5679ea39542a80;hpb=94010e71b67db04027249ff69e2a2bfa9a050945;p=p5sagit%2Fp5-mst-13.2.git diff --git a/pp_ctl.c b/pp_ctl.c index d39d356..2a10ab0 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -204,7 +204,7 @@ PP(pp_substcont) } rxres_restore(&cx->sb_rxres, rx); - RX_MATCH_UTF8_set(rx, SvUTF8(cx->sb_targ)); + RX_MATCH_UTF8_set(rx, DO_UTF8(cx->sb_targ)); if (cx->sb_iters++) { const I32 saviters = cx->sb_iters; @@ -314,7 +314,7 @@ Perl_rxres_save(pTHX_ void **rsp, REGEXP *rx) i = 6 + rx->nparens * 2; #endif if (!p) - New(501, p, i, UV); + Newx(p, i, UV); else Renew(p, i, UV); *rsp = (void*)p; @@ -1778,7 +1778,8 @@ PP(pp_dbstate) PUSHSUB_DB(cx); cx->blk_sub.retop = PL_op->op_next; CvDEPTH(cv)++; - PAD_SET_CUR(CvPADLIST(cv),1); + SAVECOMPPAD(); + PAD_SET_CUR_NOSAVE(CvPADLIST(cv), 1); RETURNOP(CvSTART(cv)); } else @@ -2055,13 +2056,14 @@ PP(pp_last) register PERL_CONTEXT *cx; I32 pop2 = 0; I32 gimme; - I32 optype = 0; + I32 optype; OP *nextop; SV **newsp; PMOP *newpm; SV **mark; SV *sv = Nullsv; + if (PL_op->op_flags & OPf_SPECIAL) { cxix = dopoptoloop(cxstack_ix); if (cxix < 0) @@ -2076,7 +2078,6 @@ PP(pp_last) dounwind(cxix); POPBLOCK(cx,newpm); - PERL_UNUSED_VAR(optype); cxstack_ix++; /* temporarily protect top context */ mark = newsp; switch (CxTYPE(cx)) { @@ -2134,6 +2135,8 @@ PP(pp_last) PL_curpm = newpm; /* ... and pop $1 et al */ LEAVESUB(sv); + PERL_UNUSED_VAR(optype); + PERL_UNUSED_VAR(gimme); return nextop; } @@ -2207,7 +2210,6 @@ PP(pp_redo) STATIC OP * S_dofindlabel(pTHX_ OP *o, const char *label, OP **opstack, OP **oplimit) { - OP *kid = Nullop; OP **ops = opstack; static const char too_deep[] = "Target of goto is too deeply nested"; @@ -2225,6 +2227,7 @@ S_dofindlabel(pTHX_ OP *o, const char *label, OP **opstack, OP **oplimit) } *ops = 0; if (o->op_flags & OPf_KIDS) { + OP *kid; /* First try all the kids at this level, since that's likeliest. */ for (kid = cUNOPo->op_first; kid; kid = kid->op_sibling) { if ((kid->op_type == OP_NEXTSTATE || kid->op_type == OP_DBSTATE) && @@ -2270,7 +2273,7 @@ PP(pp_goto) static const char must_have_label[] = "goto must have label"; if (PL_op->op_flags & OPf_STACKED) { - SV *sv = POPs; + SV * const sv = POPs; /* This egregious kludge implements goto &subroutine */ if (SvROK(sv) && SvTYPE(SvRV(sv)) == SVt_PVCV) { @@ -2340,8 +2343,7 @@ PP(pp_goto) } } else if (CvXSUB(cv)) { /* put GvAV(defgv) back onto stack */ - AV* av; - av = GvAV(PL_defgv); + AV* const av = GvAV(PL_defgv); items = AvFILLp(av) + 1; EXTEND(SP, items+1); /* @_ could have been extended. */ Copy(AvARRAY(av), SP + 1, items, SV*); @@ -2415,7 +2417,8 @@ PP(pp_goto) sub_crush_depth(cv); pad_push(padlist, CvDEPTH(cv)); } - PAD_SET_CUR(padlist, CvDEPTH(cv)); + SAVECOMPPAD(); + PAD_SET_CUR_NOSAVE(padlist, CvDEPTH(cv)); if (cx->blk_sub.hasargs) { AV* av = (AV*)PAD_SVl(0); @@ -2459,12 +2462,12 @@ PP(pp_goto) * We do not care about using sv to call CV; * it's for informational purposes only. */ - SV *sv = GvSV(PL_DBsub); + SV * const sv = GvSV(PL_DBsub); CV *gotocv; save_item(sv); if (PERLDB_SUB_NN) { - int type = SvTYPE(sv); + const int type = SvTYPE(sv); if (type < SVt_PVIV && type != SVt_IV) sv_upgrade(sv, SVt_PVIV); (void)SvIOK_on(sv); @@ -2680,12 +2683,12 @@ STATIC void S_save_lines(pTHX_ AV *array, SV *sv) { const char *s = SvPVX_const(sv); - const char *send = SvPVX_const(sv) + SvCUR(sv); + const char * const send = SvPVX_const(sv) + SvCUR(sv); I32 line = 1; while (s && s < send) { const char *t; - SV *tmpstr = NEWSV(85,0); + SV * const tmpstr = NEWSV(85,0); sv_upgrade(tmpstr, SVt_PVMG); t = strchr(s, '\n'); @@ -2766,7 +2769,7 @@ Perl_sv_compile_2op(pTHX_ SV *sv, OP** startop, const char *code, PAD** padp) dVAR; dSP; /* Make POPBLOCK work. */ PERL_CONTEXT *cx; SV **newsp; - I32 gimme = 0; /* SUSPECT - INITIALZE TO WHAT? NI-S */ + I32 gimme = G_VOID; I32 optype; OP dummy; OP *rop; @@ -2786,7 +2789,7 @@ Perl_sv_compile_2op(pTHX_ SV *sv, OP** startop, const char *code, PAD** padp) CopSTASH_set(&PL_compiling, PL_curstash); } if (PERLDB_NAMEEVAL && CopLINE(PL_curcop)) { - SV *sv = sv_newmortal(); + SV * const sv = sv_newmortal(); Perl_sv_setpvf(aTHX_ sv, "_<(%.10seval %lu)[%s:%"IVdf"]", code, (unsigned long)++PL_evalseq, CopFILE(PL_curcop), (IV)CopLINE(PL_curcop)); @@ -2841,6 +2844,9 @@ Perl_sv_compile_2op(pTHX_ SV *sv, OP** startop, const char *code, PAD** padp) #ifdef OP_IN_REGISTER op = PL_opsave; #endif + PERL_UNUSED_VAR(newsp); + PERL_UNUSED_VAR(optype); + return rop; } @@ -2896,7 +2902,7 @@ STATIC OP * S_doeval(pTHX_ int gimme, OP** startop, CV* outside, U32 seq) { dVAR; dSP; - OP *saveop = PL_op; + OP * const saveop = PL_op; PL_in_eval = ((saveop && saveop->op_type == OP_REQUIRE) ? (EVAL_INREQUIRE | (PL_in_eval & EVAL_INEVAL)) @@ -2944,8 +2950,9 @@ S_doeval(pTHX_ int gimme, OP** startop, CV* outside, U32 seq) sv_setpvn(ERRSV,"",0); if (yyparse() || PL_error_count || !PL_eval_root) { SV **newsp; /* Used by POPBLOCK. */ - PERL_CONTEXT *cx = &cxstack[cxstack_ix]; + PERL_CONTEXT *cx = &cxstack[cxstack_ix]; I32 optype = 0; /* Might be reset by POPEVAL. */ + const char *msg; PL_op = saveop; if (PL_eval_root) { @@ -2959,8 +2966,9 @@ S_doeval(pTHX_ int gimme, OP** startop, CV* outside, U32 seq) } lex_end(); LEAVE; + + msg = SvPVx_nolen_const(ERRSV); if (optype == OP_REQUIRE) { - const char* const msg = SvPVx_nolen_const(ERRSV); const SV * const nsv = cx->blk_eval.old_namesv; (void)hv_store(GvHVn(PL_incgv), SvPVX_const(nsv), SvCUR(nsv), &PL_sv_undef, 0); @@ -2968,19 +2976,17 @@ S_doeval(pTHX_ int gimme, OP** startop, CV* outside, U32 seq) *msg ? msg : "Unknown error\n"); } else if (startop) { - const char* msg = SvPVx_nolen_const(ERRSV); - POPBLOCK(cx,PL_curpm); POPEVAL(cx); Perl_croak(aTHX_ "%sCompilation failed in regexp", (*msg ? msg : "Unknown error\n")); } else { - const char* msg = SvPVx_nolen_const(ERRSV); if (!*msg) { sv_setpv(ERRSV, "Compilation error"); } } + PERL_UNUSED_VAR(newsp); RETPUSHUNDEF; } CopLINE_set(&PL_compiling, 0); @@ -3008,7 +3014,7 @@ S_doeval(pTHX_ int gimme, OP** startop, CV* outside, U32 seq) /* Register with debugger: */ if (PERLDB_INTER && saveop->op_type == OP_REQUIRE) { - CV *cv = get_cv("DB::postponed", FALSE); + CV * const cv = get_cv("DB::postponed", FALSE); if (cv) { dSP; PUSHMARK(SP); @@ -3036,14 +3042,14 @@ S_doopen_pm(pTHX_ const char *name, const char *mode) PerlIO *fp; if (namelen > 3 && strEQ(name + namelen - 3, ".pm")) { - SV *pmcsv = Perl_newSVpvf(aTHX_ "%s%c", name, 'c'); + SV * const pmcsv = Perl_newSVpvf(aTHX_ "%s%c", name, 'c'); const char * const pmc = SvPV_nolen_const(pmcsv); - Stat_t pmstat; Stat_t pmcstat; if (PerlLIO_stat(pmc, &pmcstat) < 0) { fp = PerlIO_open(name, mode); } else { + Stat_t pmstat; if (PerlLIO_stat(name, &pmstat) < 0 || pmstat.st_mtime < pmcstat.st_mtime) { @@ -3371,7 +3377,7 @@ PP(pp_require) PL_compiling.cop_io = Nullsv; if (filter_sub || filter_child_proc) { - SV *datasv = filter_add(run_user_filter, Nullsv); + SV * const datasv = filter_add(run_user_filter, Nullsv); IoLINES(datasv) = filter_has_file; IoFMT_GV(datasv) = (GV *)filter_child_proc; IoTOP_GV(datasv) = (GV *)filter_state; @@ -3410,7 +3416,8 @@ PP(pp_entereval) dVAR; dSP; register PERL_CONTEXT *cx; dPOPss; - const I32 gimme = GIMME_V, was = PL_sub_generation; + const I32 gimme = GIMME_V; + const I32 was = PL_sub_generation; char tbuf[TYPE_DIGITS(long) + 12]; char *tmpbuf = tbuf; char *safestr; @@ -3430,7 +3437,7 @@ PP(pp_entereval) /* switch to eval mode */ if (PERLDB_NAMEEVAL && CopLINE(PL_curcop)) { - SV *sv = sv_newmortal(); + SV * const sv = sv_newmortal(); Perl_sv_setpvf(aTHX_ sv, "_<(eval %lu)[%s:%"IVdf"]", (unsigned long)++PL_evalseq, CopFILE(PL_curcop), (IV)CopLINE(PL_curcop)); @@ -3588,6 +3595,7 @@ PP(pp_leavetry) POPBLOCK(cx,newpm); POPEVAL(cx); + PERL_UNUSED_VAR(optype); TAINT_NOT; if (gimme == G_VOID) @@ -3652,7 +3660,7 @@ S_doparseform(pTHX_ SV *sv) s = base; base = Nullch; - New(804, fops, maxops, U32); + Newx(fops, maxops, U32); fpc = fops; if (s < send) {