Subject: [PATCH 3/5] grep: avoid to re-build a state built previously.

From: Paolo Bonzini <[email-masked]>
Date: Tue, 1 Apr 2014 11:18:44 +0200

From: Norihiro Tanaka <[email-masked]>

* src/dfa.c (dfaexec): avoid to re-build a state built previously.
---
 src/dfa.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/dfa.c b/src/dfa.c
index a7f0056..c06c922 100644
--- a/src/dfa.c
+++ b/src/dfa.c
@@ -3533,7 +3533,8 @@ dfaexec (struct dfa *d, char const *begin, char *end,
 
       if (s >= 0)
         {
-          build_state (s, d);
+          if (!d->trans[s])
+            build_state (s, d);
           trans = d->trans;
           continue;
         }
-- 
1.9.0