re_intuit_start(): use memchr() to find \n
authorDavid Mitchell <davem@iabyn.com>
Fri, 7 Feb 2014 14:15:26 +0000 (14:15 +0000)
committerDavid Mitchell <davem@iabyn.com>
Sat, 8 Feb 2014 13:50:24 +0000 (13:50 +0000)
commitd0880ea774e2c5aa93b0328c7fdb39c2dbd8e239
tree9f636d7957d6e35191a5f53932ae76d09f52df61
parent197641b60fd10e1980dcb015bce2c9f9f21cdb11
re_intuit_start(): use memchr() to find \n

The code that scans for another \n when the /^.../m constraint has failed
currently searches for the \n in a big while loop. Use memchr() instead,
which is likely to to be as efficient as possible on any given platform.
Also invert the sense of most of the tests following a found \n,
which removes lots indented ifs, and leaves us with a clean set of

    if (A)
        goto X;
    if (B)
        goto Y;
    if (C)
        goto Z;
regexec.c