diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2016-07-19 21:47:40 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2016-07-19 21:47:40 -0700 |
commit | d4b6ca2a14f7c74bff7563954b5c6d37786d4ca0 (patch) | |
tree | aaac5c57ba6081b5da18cb16f98a26643b9eeaea /lib.c | |
parent | f2bd891e24b4d2e6b06837f00c3f74199f2fbf75 (diff) | |
download | txr-d4b6ca2a14f7c74bff7563954b5c6d37786d4ca0.tar.gz txr-d4b6ca2a14f7c74bff7563954b5c6d37786d4ca0.tar.bz2 txr-d4b6ca2a14f7c74bff7563954b5c6d37786d4ca0.zip |
NFA regex optimization: use just one set array.
We don't have to flip between two arrays, since the
nfa_closure and and nfa_move_closure can write the
output set into the same array.
* regex.c (struct nfa_machine): Replace flip and flop
members with a single set.
(nfa_closure, nfa_move_closure): out array parameter removed;
in renamed to set. References to in and out simply replaced
with set.
(nfa_run): Allocate one set instead of two, plus the stack.
Remove code to swap the two pointers on each iteration.
(regex_machine_reset): Prepare initial closure in the one
and only set array.
(regex_machine_init): Allocate set array, rather than flip an
flop.
(regex_machine_cleanup): Free set array and null out pointer
rather than flip and flop arrays.
(regex_machine_feed): Pass just the set ot the
nfa_move_closure function. Remove flip/flop pointer swapping
Diffstat (limited to 'lib.c')
0 files changed, 0 insertions, 0 deletions