re_intuit_start(): update rx_origin after check
authorDavid Mitchell <davem@iabyn.com>
Sun, 26 Jan 2014 16:07:17 +0000 (16:07 +0000)
committerDavid Mitchell <davem@iabyn.com>
Fri, 7 Feb 2014 22:39:37 +0000 (22:39 +0000)
commitfdc003fd1d22441061e822c854d4167a612e754e
treed9c49bc79cc4462c2fde33c2a31ac08c5b0506a4
parent6480a6c448dec40aad54025b06ea6b8bdbc54527
re_intuit_start(): update rx_origin after check

Previously the code for updating rx_origin after a 'check' match or an
'other' match looked a bit like this:

    s = fbm_instr(check);

    if (other exists) {
        if (other is anchored) {
            rx_origin = HOP3c(s, -prog->check_offset_max);
            ....
        }
        else {
            rx_origin = HOP3c(s, -prog->check_offset_min);
            ....
        }
    }
    else
        rx_origin = HOP3c(s, -prog->check_offset_max);

This commit changes it to

    s = fbm_instr(check);
    rx_origin = HOP3c(s, -prog->check_offset_max);

    if (other exists) {
        if (other is anchored) {
            ....
        }
        else {
            ....
        }
    }

Of course in each case the 'HOP3' code was slightly different, but they
all happened to be equivalent, especially as for an anchored string,
check_offset_min == check_offset_max.

The only complication was a goto do_other_anchored, but it turns
out that setting rx_origin in that case was easy.
regexec.c