summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNorihiro Tanaka <noritnk@kcn.ne.jp>2016-09-02 00:41:02 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2016-09-02 00:41:34 -0700
commit2c0190b809098530e3281fbc4ed1de44e17a65a3 (patch)
tree9cb6b1ac62ead0e024212fea1e18432cc04fcb5f
parent10d25bf1807deea5683986c3c158cff021407b6a (diff)
downloadgrep-2c0190b809098530e3281fbc4ed1de44e17a65a3.tar.gz
dfa: simplify to find state index for state 0
* src/dfa.c (dfastate): Simplify to find state index for state 0.
-rw-r--r--src/dfa.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/src/dfa.c b/src/dfa.c
index 00562ea0..1a4a90ae 100644
--- a/src/dfa.c
+++ b/src/dfa.c
@@ -2671,18 +2671,9 @@ dfastate (state_num s, struct dfa *d, state_num trans[])
is to fail miserably. */
if (d->searchflag)
{
- /* Find the state(s) corresponding to the positions of state 0. */
- copy (&d->states[0].elems, &follows);
- separate_contexts = state_separate_contexts (&follows);
- state = state_index (d, &follows, separate_contexts ^ CTX_ANY);
- if (separate_contexts & CTX_NEWLINE)
- state_newline = state_index (d, &follows, CTX_NEWLINE);
- else
- state_newline = state;
- if (separate_contexts & CTX_LETTER)
- state_letter = state_index (d, &follows, CTX_LETTER);
- else
- state_letter = state;
+ state_newline = 0;
+ state_letter = d->min_trcount - 1;
+ state = d->initstate_notbol;
for (i = 0; i < NOTCHAR; ++i)
trans[i] = unibyte_word_constituent (d, i) ? state_letter : state;