re_intuit_start(): harmonise other_last++
authorDavid Mitchell <davem@iabyn.com>
Sat, 1 Feb 2014 00:33:11 +0000 (00:33 +0000)
committerDavid Mitchell <davem@iabyn.com>
Sat, 8 Feb 2014 13:50:09 +0000 (13:50 +0000)
commit7d4ad9f90baf4256bba3cc273851b52721d4074c
tree6c44c011fb4d90d6b75cb9e98cc1589c6be149cd
parente176ee937f117fc2c220e253b4134cf677626b67
re_intuit_start(): harmonise other_last++

In the other=anchored branch, at the end on failure or success, we
set other_last to HOP3(last, 1) or HOP3(s, 1) respectively,
indicating the minimum point we should start matching if we ever
have to try again. Clearly for failure, we know the substring can't be
found at any position up to, or including last, so next time we should try
at last+1. For success, if we return later it means that some other
constraint failed, and we already know that the substr wasn't found at
positions up to s-1, and that if we tried position s again we'd just
repeat the previous failure. So in both cases set to N+1.

In the other=float branch however, other_last is set to last or s on
failure or success, with a big "XXX is this right?" against the
"other_last = s" code. It turns out that "other_last = s" *is* right, for
the special reasons explained in the code comments added by this commit;
while "other_last = last" is changed to be "other_last = HOP3(last,1)".
regexec.c