diff options
author | Nicholas Clark <nick@ccl4.org> | 2006-04-17 12:48:43 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2006-04-17 12:48:43 +0000 |
commit | c2b7afd3c0b668fe31fd8835d487d6343bfcf526 (patch) | |
tree | fc89bf0132db7de061fc004b91b5c1bb1a2576ed /regexec.c | |
parent | 52ef5499a7834e9d44061a993a2621a1bf3a4def (diff) | |
download | perl-c2b7afd3c0b668fe31fd8835d487d6343bfcf526.tar.gz |
Add Dave's explainations of why certain pointers are always non-NULL,
and assert() that it is true.
p4raw-id: //depot/perl@27866
Diffstat (limited to 'regexec.c')
-rw-r--r-- | regexec.c | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -3531,6 +3531,18 @@ S_regmatch(pTHX_ const regmatch_info *reginfo, regnode *prog) /* No need to save/restore up to this paren */ I32 parenfloor = scan->flags; + /* Dave says: + + CURLYX and WHILEM are always paired: they're the moral + equivalent of pp_enteriter anbd pp_iter. + + The only time next could be null is if the node tree is + corrupt. This was mentioned on p5p a few days ago. + + See http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2006-04/msg00556.html + So we'll assert that this is true: + */ + assert(next); if (OP(PREVOPER(next)) == NOTHING) /* LONGJMP */ next += ARG(next); /* XXXX Probably it is better to teach regpush to support @@ -3570,6 +3582,16 @@ S_regmatch(pTHX_ const regmatch_info *reginfo, regnode *prog) * that we can try again after backing off. */ + /* Dave says: + + st->cc gets initialised by CURLYX ready for use by WHILEM. + So again, unless somethings been corrupted, st->cc cannot + be null at that point in WHILEM. + + See http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2006-04/msg00556.html + So we'll assert that this is true: + */ + assert(st->cc); st->u.whilem.lastloc = st->cc->u.curlyx.lastloc; /* Detection of 0-len. */ st->u.whilem.cache_offset = 0; st->u.whilem.cache_bit = 0; |