X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pp.c;h=e998e211e9bdb42938d1d17d7518ff3004b45c48;hb=9e5bbba0de25c01ae9355c7a97e237602a37e9f3;hp=8f01e85621ed8dd6dbb43dc515f709559baee6f6;hpb=1c90055717b05b3f652bf543a46419001314c53e;p=p5sagit%2Fp5-mst-13.2.git diff --git a/pp.c b/pp.c index 8f01e85..e998e21 100644 --- a/pp.c +++ b/pp.c @@ -132,7 +132,7 @@ PP(pp_padhv) /* Translations. */ -const char S_no_symref_sv[] = +static const char S_no_symref_sv[] = "Can't use string (\"%" SVf32 "\"%s) as %s ref while \"strict refs\" in use"; PP(pp_rv2gv) @@ -207,7 +207,7 @@ PP(pp_rv2gv) } else { if (PL_op->op_private & HINT_STRICT_REFS) - DIE(aTHX_ S_no_symref_sv, sv, (SvCUR(sv)>32 ? "..." : ""), "a symbol"); + DIE(aTHX_ S_no_symref_sv, sv, (SvPOK(sv) && SvCUR(sv)>32 ? "..." : ""), "a symbol"); if ((PL_op->op_private & (OPpLVAL_INTRO|OPpDONT_INIT_GV)) == OPpDONT_INIT_GV) { /* We are the target of a coderef assignment. Return @@ -237,7 +237,7 @@ Perl_softref2xv(pTHX_ SV *const sv, const char *const what, if (PL_op->op_private & HINT_STRICT_REFS) { if (SvOK(sv)) - Perl_die(aTHX_ S_no_symref_sv, sv, (SvCUR(sv)>32 ? "..." : ""), what); + Perl_die(aTHX_ S_no_symref_sv, sv, (SvPOK(sv) && SvCUR(sv)>32 ? "..." : ""), what); else Perl_die(aTHX_ PL_no_usym, what); } @@ -1030,7 +1030,7 @@ PP(pp_pow) on same algorithm as above */ register UV result = 1; register UV base = baseuv; - const bool odd_power = (bool)(power & 1); + const bool odd_power = cBOOL(power & 1); if (odd_power) { result *= base; } @@ -2485,14 +2485,14 @@ PP(pp_negate) PP(pp_not) { - dVAR; dSP; tryAMAGICunSET(not); + dVAR; dSP; tryAMAGICunSET_var(not_amg); *PL_stack_sp = boolSV(!SvTRUE(*PL_stack_sp)); return NORMAL; } PP(pp_complement) { - dVAR; dSP; dTARGET; tryAMAGICun(compl); + dVAR; dSP; dTARGET; tryAMAGICun_var(compl_amg); { dTOPss; SvGETMAGIC(sv); @@ -3204,10 +3204,10 @@ PP(pp_substr) /* pos1_iv and pos2_iv both in 0..curlen, so the cast is safe */ const STRLEN pos = (STRLEN)( (UV)pos1_iv ); const STRLEN len = (STRLEN)( (UV)pos2_iv - (UV)pos1_iv ); - STRLEN byte_pos = pos; STRLEN byte_len = len; - if (utf8_curlen) - sv_pos_u2b_proper(sv, &byte_pos, &byte_len); + STRLEN byte_pos = utf8_curlen + ? sv_pos_u2b_flags(sv, pos, &byte_len, SV_CONST_RETURN) : pos; + tmps += byte_pos; /* we either return a PV or an LV. If the TARG hasn't been used * before, or is of that type, reuse it; otherwise use a mortal @@ -3439,6 +3439,7 @@ PP(pp_sprintf) dVAR; dSP; dMARK; dORIGMARK; dTARGET; if (SvTAINTED(MARK[1])) TAINT_PROPER("sprintf"); + SvTAINTED_off(TARG); do_sprintf(TARG, SP-MARK, MARK+1); TAINT_IF(SvTAINTED(TARG)); SP = ORIGMARK; @@ -5325,7 +5326,8 @@ PP(pp_shift) { dVAR; dSP; - AV * const av = MUTABLE_AV(POPs); + AV * const av = PL_op->op_flags & OPf_SPECIAL + ? MUTABLE_AV(GvAV(PL_defgv)) : MUTABLE_AV(POPs); SV * const sv = PL_op->op_type == OP_SHIFT ? av_shift(av) : av_pop(av); EXTEND(SP, 1); assert (sv); @@ -5418,12 +5420,15 @@ PP(pp_reverse) } else { SV **begin = AvARRAY(av); - SV **end = begin + AvFILLp(av); - while (begin < end) { - register SV * const tmp = *begin; - *begin++ = *end; - *end-- = tmp; + if (begin) { + SV **end = begin + AvFILLp(av); + + while (begin < end) { + register SV * const tmp = *begin; + *begin++ = *end; + *end-- = tmp; + } } } }