summaryrefslogtreecommitdiff
path: root/regexec.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2006-04-17 12:48:43 +0000
committerNicholas Clark <nick@ccl4.org>2006-04-17 12:48:43 +0000
commitc2b7afd3c0b668fe31fd8835d487d6343bfcf526 (patch)
treefc89bf0132db7de061fc004b91b5c1bb1a2576ed /regexec.c
parent52ef5499a7834e9d44061a993a2621a1bf3a4def (diff)
downloadperl-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.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/regexec.c b/regexec.c
index 4d0388db0e..50f164ff89 100644
--- a/regexec.c
+++ b/regexec.c
@@ -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;