mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-06-28 16:41:01 +03:00
ng_region: simplify checkAndAddExitCandidate
This commit is contained in:
parent
7396c93990
commit
d63fdcd860
@ -87,22 +87,19 @@ static
|
|||||||
void checkAndAddExitCandidate(const AcyclicGraph &g,
|
void checkAndAddExitCandidate(const AcyclicGraph &g,
|
||||||
const ue2::unordered_set<NFAVertex> &r,
|
const ue2::unordered_set<NFAVertex> &r,
|
||||||
NFAVertex v, vector<exit_info> &exits) {
|
NFAVertex v, vector<exit_info> &exits) {
|
||||||
// set when we find our first candidate.
|
exit_info v_exit(v);
|
||||||
decltype(exit_info::open) *open = nullptr;
|
auto &open = v_exit.open;
|
||||||
|
|
||||||
/* find the set of vertices reachable from v which are not in r */
|
/* find the set of vertices reachable from v which are not in r */
|
||||||
for (auto w : adjacent_vertices_range(v, g)) {
|
for (auto w : adjacent_vertices_range(v, g)) {
|
||||||
if (!contains(r, NFAVertex(w))) {
|
if (!contains(r, w)) {
|
||||||
if (!open) {
|
open.insert(w);
|
||||||
exits.emplace_back(NFAVertex(v));
|
|
||||||
open = &exits.back().open;
|
|
||||||
}
|
|
||||||
open->insert(NFAVertex(w));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (open) {
|
if (!open.empty()) {
|
||||||
DEBUG_PRINTF("exit %zu\n", g[v].index);
|
DEBUG_PRINTF("exit %zu\n", g[v].index);
|
||||||
|
exits.push_back(move(v_exit));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user