In perl.git, the branch blead has been updated <https://perl5.git.perl.org/perl.git/commitdiff/8779d80ae74c415b57b9d139bb415e167292cd2a?hp=9d875cfd2b113b3cb1462875c8b92f3f08859fb5>
- Log ----------------------------------------------------------------- commit 8779d80ae74c415b57b9d139bb415e167292cd2a Author: Yves Orton <demer...@gmail.com> Date: Fri Dec 1 21:00:05 2017 +0100 fixup test that was broken by 3c67ad9b9. Error message changed from "Can't" to "Cannot" with slightly different wording, breaking t/run/switches.t commit 349ac40cfe6901fb2054c054b3fe3388bebde35d Author: Yves Orton <demer...@gmail.com> Date: Fri Dec 1 19:35:02 2017 +0100 comment entry points to study_chunk so it is a bit easier to follow what they are used for. commit 9607fbb7cdfce88351b3ca3fcc5d4c96e616da63 Author: Yves Orton <demer...@gmail.com> Date: Fri Dec 1 19:32:46 2017 +0100 comment out unreachable code and explain why it was/is there ----------------------------------------------------------------------- Summary of changes: regcomp.c | 16 ++++++++++++++++ t/run/switches.t | 2 +- zaphod32_hash.h | 5 ++++- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/regcomp.c b/regcomp.c index 74888ca629..fcedc3629f 100644 --- a/regcomp.c +++ b/regcomp.c @@ -4287,6 +4287,7 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_state, regnode **scanp, /* we suppose the run is continuous, last=next... * NOTE we dont use the return here! */ + /* DEFINEP study_chunk() recursion */ (void)study_chunk(pRExC_state, &scan, &minlen, &deltanext, next, &data_fake, stopparen, recursed_depth, NULL, f, depth+1); @@ -4354,6 +4355,7 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_state, regnode **scanp, f |= SCF_WHILEM_VISITED_POS; /* we suppose the run is continuous, last=next...*/ + /* recurse study_chunk() for each BRANCH in an alternation */ minnext = study_chunk(pRExC_state, &scan, minlenp, &deltanext, next, &data_fake, stopparen, recursed_depth, NULL, f,depth+1); @@ -5090,6 +5092,7 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_state, regnode **scanp, f &= ~SCF_WHILEM_VISITED_POS; /* This will finish on WHILEM, setting scan, or on NULL: */ + /* recurse study_chunk() on loop bodies */ minnext = study_chunk(pRExC_state, &scan, minlenp, &deltanext, last, data, stopparen, recursed_depth, NULL, (mincount == 0 @@ -5252,6 +5255,7 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_state, regnode **scanp, } #endif /* Optimize again: */ + /* recurse study_chunk() on optimised CURLYX => CURLYM */ study_chunk(pRExC_state, &nxt1, minlenp, &deltanext, nxt, NULL, stopparen, recursed_depth, NULL, 0,depth+1); } @@ -5642,6 +5646,8 @@ Perl_re_printf( aTHX_ "LHS=%" UVuf " RHS=%" UVuf "\n", f |= SCF_WHILEM_VISITED_POS; next = regnext(scan); nscan = NEXTOPER(NEXTOPER(scan)); + + /* recurse study_chunk() for lookahead body */ minnext = study_chunk(pRExC_state, &nscan, minlenp, &deltanext, last, &data_fake, stopparen, recursed_depth, NULL, f, depth+1); @@ -5732,6 +5738,7 @@ Perl_re_printf( aTHX_ "LHS=%" UVuf " RHS=%" UVuf "\n", next = regnext(scan); nscan = NEXTOPER(NEXTOPER(scan)); + /* positive lookahead study_chunk() recursion */ *minnextp = study_chunk(pRExC_state, &nscan, minnextp, &deltanext, last, &data_fake, stopparen, recursed_depth, NULL, @@ -5893,6 +5900,7 @@ Perl_re_printf( aTHX_ "LHS=%" UVuf " RHS=%" UVuf "\n", /* We go from the jump point to the branch that follows it. Note this means we need the vestigal unused branches even though they arent otherwise used. */ + /* optimise study_chunk() for TRIE */ minnext = study_chunk(pRExC_state, &scan, minlenp, &deltanext, (regnode *)nextbranch, &data_fake, stopparen, recursed_depth, NULL, f,depth+1); @@ -7573,6 +7581,10 @@ Perl_re_op_compile(pTHX_ SV ** const patternp, int pat_count, data.last_closep = &last_close; DEBUG_RExC_seen(); + /* + * MAIN ENTRY FOR study_chunk() FOR m/PATTERN/ + * (NO top level branches) + */ minlen = study_chunk(pRExC_state, &first, &minlen, &fake, scan + RExC_size, /* Up to end */ &data, -1, 0, NULL, @@ -7698,6 +7710,10 @@ Perl_re_op_compile(pTHX_ SV ** const patternp, int pat_count, data.last_closep = &last_close; DEBUG_RExC_seen(); + /* + * MAIN ENTRY FOR study_chunk() FOR m/P1|P2|.../ + * (patterns WITH top level branches) + */ minlen = study_chunk(pRExC_state, &scan, &minlen, &fake, scan + RExC_size, &data, -1, 0, NULL, SCF_DO_STCLASS_AND|SCF_WHILEM_VISITED_POS|(restudied diff --git a/t/run/switches.t b/t/run/switches.t index 50720255ee..1b1f596374 100644 --- a/t/run/switches.t +++ b/t/run/switches.t @@ -596,7 +596,7 @@ CODE chmod 0700, "tmpinplace" or die "Cannot make tmpinplace writable again: $!"; skip "Cannot make tmpinplace read only", 1 if $canwrite; - fresh_perl_like(<<'CODE', qr/Can't rename/, { stderr => 1 }, "fail final rename"); + fresh_perl_like(<<'CODE', qr/failed to rename/, { stderr => 1 }, "fail final rename"); @ARGV = ("tmpinplace/foo"); $^I = ""; while (<>) { diff --git a/zaphod32_hash.h b/zaphod32_hash.h index 31dd153def..bdbaa9a415 100644 --- a/zaphod32_hash.h +++ b/zaphod32_hash.h @@ -269,7 +269,10 @@ U32 zaphod32_hash_with_state( return v0 ^ v2; } - if (len >= 8) { +/* if (len >= 8) */ /* this block is only reached by a goto above, so this condition + is commented out, but if the above block is removed it would + be necessary to use this. */ + { zaphod32_read8: len = key_len & 0x7; end = key + key_len - len; -- Perl5 Master Repository