diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2014-12-10 22:12:26 +0200 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2014-12-10 22:12:26 +0200 |
commit | 4518d0d3c80d8c616a8a7f65548fde4866495289 (patch) | |
tree | d6f1a453af67f06305afad2d0783a13e68b802d0 | |
parent | 4ec42f2201d6d15be74de5d6d34b1baa614a2e9f (diff) | |
download | egawk-4518d0d3c80d8c616a8a7f65548fde4866495289.tar.gz egawk-4518d0d3c80d8c616a8a7f65548fde4866495289.tar.bz2 egawk-4518d0d3c80d8c616a8a7f65548fde4866495289.zip |
Sync dfa.c with grep.
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | dfa.c | 39 |
2 files changed, 19 insertions, 24 deletions
@@ -1,3 +1,7 @@ +2014-12-10 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.c: Sync with GNU grep. + 2014-11-26 Arnold D. Robbins <arnold@skeeve.com> * builtin.c (do_sub): Improve wording of gensub warnings. @@ -3496,13 +3496,23 @@ dfaexec_main (struct dfa *d, char const *begin, char *end, } } - if ((char *) p > end) + if (s < 0) { - p = NULL; - goto done; + if ((char *) p > end || p[-1] != eol || d->newlines[s1] < 0) + { + p = NULL; + goto done; + } + + /* The previous character was a newline, count it, and skip + checking of multibyte character boundary until here. */ + nlcount++; + mbp = p; + + s = allow_nl ? d->newlines[s1] : 0; } - if (s >= 0 && d->fails[s]) + if (d->fails[s]) { if (d->success[s] & sbit[*p]) { @@ -3516,32 +3526,13 @@ dfaexec_main (struct dfa *d, char const *begin, char *end, State_transition(); else s = d->fails[s][*p++]; - continue; - } - - /* If the previous character was a newline, count it, and skip - checking of multibyte character boundary until here. */ - if (p[-1] == eol) - { - nlcount++; - mbp = p; } - - if (s >= 0) + else { if (!d->trans[s]) build_state (s, d); trans = d->trans; - continue; } - - if (p[-1] == eol && allow_nl) - { - s = d->newlines[s1]; - continue; - } - - s = 0; } done: |