re_intuit_start(): rearrange /^/m code
authorDavid Mitchell <davem@iabyn.com>
Tue, 4 Feb 2014 20:26:20 +0000 (20:26 +0000)
committerDavid Mitchell <davem@iabyn.com>
Sat, 8 Feb 2014 13:50:22 +0000 (13:50 +0000)
commite3c6feb028015ee55e45cf6a3be0176069fdeb3b
treeef577b9344e402051336694b620e02caea6743ec
parentb52b7737b2243b234d5171a27622937feb18c422
re_intuit_start(): rearrange /^/m code

After matching the "check" and "other" strings, we check that
rx_origin is at a \n in the presence of /^../m. The code that
does this is in one half of an if-statement, with a couple of labels and
gotos that get us to and from the other half of the if statement.

Re-arrange the code so that the /^../m is done on its own before the if.
This removes a couple of labels and gotos and makes the code clearer.

Basically we went from:

    if (rx_origin != strpos) {
        if (ml_anch && COND_A) {
          find_anchor:
            LOOK_FOR_ANCHOR...
        }
        REST_A;
    }
    else {
        if (ml_anch && COND_B) {
            goto find_anchor;
        }
        REST_B;
    }

to:

    if (rx_origin != strpos && (ml_anch && COND_A)
    ||  rx_origin == strpos && (ml_anch && COND_B))
    {
          find_anchor:
            LOOK_FOR_ANCHOR...
        }
        ...
    }

    if (rx_origin != strpos) {
        REST_A;
    else {
        REST_B;
    }

The next couple of commits will re-indent and simplify the condition a
bit.
regexec.c