X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pp.c;h=d55c4a8eb62e92f7d08e14131770090ed6c8d620;hb=73031816b5ef6a74869c06e84bb621841a623d0a;hp=51af7d8c41a5692d7842fe6219f52e61463bc7cd;hpb=17fa0776055c3d6ef5e8451cfcb9e194ca912faa;p=p5sagit%2Fp5-mst-13.2.git diff --git a/pp.c b/pp.c index 51af7d8..d55c4a8 100644 --- a/pp.c +++ b/pp.c @@ -416,7 +416,7 @@ PP(pp_prototype) char str[ MAX_ARGS_OP * 2 + 2 ]; /* One ';', one '\0' */ if (code == -KEY_chop || code == -KEY_chomp - || code == -KEY_exec || code == -KEY_system || code == -KEY_err) + || code == -KEY_exec || code == -KEY_system) goto set; if (code == -KEY_mkdir) { ret = sv_2mortal(newSVpvs("_;$")); @@ -4066,7 +4066,7 @@ PP(pp_hslice) } he = hv_fetch_ent(hv, keysv, lval, 0); - svp = he ? &HeVAL(he) : 0; + svp = he ? &HeVAL(he) : NULL; if (lval) { if (!svp || *svp == &PL_sv_undef) { @@ -4420,12 +4420,17 @@ PP(pp_push) PUSHi( AvFILL(ary) + 1 ); } else { + PL_delaymagic = DM_DELAY; for (++MARK; MARK <= SP; MARK++) { SV * const sv = newSV(0); if (*MARK) sv_setsv(sv, *MARK); av_store(ary, AvFILLp(ary)+1, sv); } + if (PL_delaymagic & DM_ARRAY) + mg_set((SV*)ary); + + PL_delaymagic = 0; SP = ORIGMARK; PUSHi( AvFILLp(ary) + 1 ); } @@ -4711,6 +4716,53 @@ PP(pp_split) s = m; } } + else if (rx->extflags & RXf_NULL && !(s >= strend)) { + /* + Pre-extend the stack, either the number of bytes or + characters in the string or a limited amount, triggered by: + + my ($x, $y) = split //, $str; + or + split //, $str, $i; + */ + const U32 items = limit - 1; + if (items < slen) + EXTEND(SP, items); + else + EXTEND(SP, slen); + + if (do_utf8) { + while (--limit) { + /* keep track of how many bytes we skip over */ + m = s; + s += UTF8SKIP(s); + dstr = newSVpvn(m, s-m); + + if (make_mortal) + sv_2mortal(dstr); + + (void)SvUTF8_on(dstr); + PUSHs(dstr); + + if (s >= strend) + break; + } + } else { + while (--limit) { + dstr = newSVpvn(s, 1); + + s++; + + if (make_mortal) + sv_2mortal(dstr); + + PUSHs(dstr); + + if (s >= strend) + break; + } + } + } else if (do_utf8 == ((rx->extflags & RXf_UTF8) != 0) && (rx->extflags & RXf_USE_INTUIT) && !rx->nparens && (rx->extflags & RXf_CHECK_ALL) @@ -4880,6 +4932,19 @@ PP(pp_split) RETURN; } +PP(pp_once) +{ + dSP; + SV *const sv = PAD_SVl(PL_op->op_targ); + + if (SvPADSTALE(sv)) { + /* First time. */ + SvPADSTALE_off(sv); + RETURNOP(cLOGOP->op_other); + } + RETURNOP(cLOGOP->op_next); +} + PP(pp_lock) { dVAR;