From 69d1638574237101d296cad19a9a99da917c9217 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Wed, 13 Sep 2017 06:48:16 -0700 Subject: regex: bugfix: squash duplicates in move set. * regex.c (nfa_move_closure): The move set calculation is wrongly assuming that all of the states are new and not testing their visited color. This could result in the same state being added twice. Though harmless, it wastefully inflates the set size. --- regex.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/regex.c b/regex.c index 61cef2e6..314110f7 100644 --- a/regex.c +++ b/regex.c @@ -1351,8 +1351,7 @@ static int nfa_move_closure(nfa_state_t **stack, nfa_state_t **set, int nin, bug_unless (stackp < nstates); - if (mov != 0) { - mov->a.visited = visited; + if (nfa_test_set_visited(mov, visited)) { stack[stackp++] = mov; set[nout++] = mov; if (nfa_accept_state_p(mov)) -- cgit v1.2.3