summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2014-12-10 22:13:17 +0200
committerArnold D. Robbins <arnold@skeeve.com>2014-12-10 22:13:17 +0200
commit3a19aae5768c877d02bd9149ec7658fdf8551632 (patch)
tree983b77b34229731a976f6e2af9764c234e713756
parent0b64dd8ffff784984a7634593be57ceb8e292b14 (diff)
parentedfe2064ee8285ccc70b9254ed191d5cef1de14f (diff)
downloadgawk-nolibtool.tar.gz
Merge branch 'master' into nolibtoolnolibtool
-rw-r--r--ChangeLog4
-rw-r--r--dfa.c39
2 files changed, 19 insertions, 24 deletions
diff --git a/ChangeLog b/ChangeLog
index 5119ac54..ac30d2b4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
diff --git a/dfa.c b/dfa.c
index f8fd6148..6d63acf8 100644
--- a/dfa.c
+++ b/dfa.c
@@ -3484,13 +3484,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])
{
@@ -3504,32 +3514,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: