diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2017-09-13 06:48:16 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2017-09-13 06:48:16 -0700 |
commit | 69d1638574237101d296cad19a9a99da917c9217 (patch) | |
tree | e95223d2cd9cd1db63404eda37fc1d89504c0aa0 /regex.c | |
parent | 1dcaca6fb851e21b4b6da0a5639431c481a57b04 (diff) | |
download | txr-69d1638574237101d296cad19a9a99da917c9217.tar.gz txr-69d1638574237101d296cad19a9a99da917c9217.tar.bz2 txr-69d1638574237101d296cad19a9a99da917c9217.zip |
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.
Diffstat (limited to 'regex.c')
-rw-r--r-- | regex.c | 3 |
1 files changed, 1 insertions, 2 deletions
@@ -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)) |