mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2026-01-17 16:00:26 +03:00
phase 1 of addressing cppcheck useStlAlgorithm warnings,
this set only includes fill and copy operations.
This commit is contained in:
@@ -62,11 +62,13 @@ void pruneUnreachable(NGHolder &g) {
|
||||
&& edge(g.accept, g.acceptEod, g).second) {
|
||||
// Trivial case: there are no in-edges to our accepts (other than
|
||||
// accept->acceptEod), so all non-specials are unreachable.
|
||||
for (auto v : vertices_range(g)) {
|
||||
if (!is_special(v, g)) {
|
||||
dead.emplace_back(v);
|
||||
}
|
||||
}
|
||||
|
||||
auto deads = [&g=g](const NFAVertex &v) {
|
||||
return (!is_special(v, g));
|
||||
};
|
||||
const auto &vr = vertices_range(g);
|
||||
std::copy_if(begin(vr), end(vr), std::back_inserter(dead), deads);
|
||||
|
||||
} else {
|
||||
// Walk a reverse graph from acceptEod with Boost's depth_first_visit
|
||||
// call.
|
||||
@@ -199,17 +201,17 @@ void pruneHighlanderAccepts(NGHolder &g, const ReportManager &rm) {
|
||||
}
|
||||
|
||||
vector<NFAEdge> dead;
|
||||
auto deads = [&g=g](const NFAEdge &e) {
|
||||
return (!is_any_accept(target(e, g), g));
|
||||
};
|
||||
for (auto u : inv_adjacent_vertices_range(g.accept, g)) {
|
||||
if (is_special(u, g)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// We can prune any out-edges that aren't accepts
|
||||
for (const auto &e : out_edges_range(u, g)) {
|
||||
if (!is_any_accept(target(e, g), g)) {
|
||||
dead.emplace_back(e);
|
||||
}
|
||||
}
|
||||
const auto &er = out_edges_range(u, g);
|
||||
std::copy_if(begin(er), end(er), std::back_inserter(dead), deads);
|
||||
}
|
||||
|
||||
if (dead.empty()) {
|
||||
|
||||
Reference in New Issue
Block a user