mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-11-20 10:56:40 +03:00
determinise: use queue, improve api
- Use a queue rather than always building the full vector of state sets. - Make more use of move, emplace, reserve. - Write directly into dstates argument. - Return bool rather than int.
This commit is contained in:
committed by
Matthew Barr
parent
64db576b9e
commit
31141dd35b
@@ -433,6 +433,7 @@ public:
|
||||
}
|
||||
return allExternalReports(*rm, test_reports);
|
||||
}
|
||||
|
||||
private:
|
||||
const ReportManager *rm;
|
||||
public:
|
||||
@@ -568,7 +569,7 @@ unique_ptr<raw_dfa> buildMcClellan(const NGHolder &graph,
|
||||
/* Fast path. Automaton_Graph uses a bitfield internally to represent
|
||||
* states and is quicker than Automaton_Big. */
|
||||
Automaton_Graph n(rm, graph, single_trigger, triggers, prunable);
|
||||
if (determinise(n, rdfa->states, state_limit)) {
|
||||
if (!determinise(n, rdfa->states, state_limit)) {
|
||||
DEBUG_PRINTF("state limit exceeded\n");
|
||||
return nullptr; /* over state limit */
|
||||
}
|
||||
@@ -580,7 +581,7 @@ unique_ptr<raw_dfa> buildMcClellan(const NGHolder &graph,
|
||||
} else {
|
||||
/* Slow path. Too many states to use Automaton_Graph. */
|
||||
Automaton_Big n(rm, graph, single_trigger, triggers, prunable);
|
||||
if (determinise(n, rdfa->states, state_limit)) {
|
||||
if (!determinise(n, rdfa->states, state_limit)) {
|
||||
DEBUG_PRINTF("state limit exceeded\n");
|
||||
return nullptr; /* over state limit */
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user