mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-12-31 13:49:07 +03:00
addressing cppcheck shadowFunction warnings
This commit is contained in:
@@ -506,14 +506,14 @@ bool transformMinLengthToRepeat(NGHolder &g, ReportManager &rm) {
|
||||
while (v != cyclic) {
|
||||
DEBUG_PRINTF("vertex %zu\n", g[v].index);
|
||||
width++;
|
||||
auto succ = succs(v, g);
|
||||
if (contains(succ, cyclic)) {
|
||||
if (succ.size() == 1) {
|
||||
auto s = succs(v, g);
|
||||
if (contains(s, cyclic)) {
|
||||
if (s.size() == 1) {
|
||||
v = cyclic;
|
||||
} else if (succ.size() == 2) {
|
||||
} else if (s.size() == 2) {
|
||||
// Cyclic and jump edge.
|
||||
succ.erase(cyclic);
|
||||
NFAVertex v2 = *succ.begin();
|
||||
s.erase(cyclic);
|
||||
NFAVertex v2 = *s.begin();
|
||||
if (!edge(cyclic, v2, g).second) {
|
||||
DEBUG_PRINTF("bad form\n");
|
||||
return false;
|
||||
@@ -524,11 +524,11 @@ bool transformMinLengthToRepeat(NGHolder &g, ReportManager &rm) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (succ.size() != 1) {
|
||||
if (s.size() != 1) {
|
||||
DEBUG_PRINTF("bad form\n");
|
||||
return false;
|
||||
}
|
||||
v = *succ.begin();
|
||||
v = *s.begin();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -544,12 +544,12 @@ bool transformMinLengthToRepeat(NGHolder &g, ReportManager &rm) {
|
||||
while (!is_any_accept(v, g)) {
|
||||
DEBUG_PRINTF("vertex %zu\n", g[v].index);
|
||||
width++;
|
||||
auto succ = succs(v, g);
|
||||
if (succ.size() != 1) {
|
||||
auto s = succs(v, g);
|
||||
if (s.size() != 1) {
|
||||
DEBUG_PRINTF("bad form\n");
|
||||
return false;
|
||||
}
|
||||
v = *succ.begin();
|
||||
v = *s.begin();
|
||||
}
|
||||
|
||||
int offsetAdjust = 0;
|
||||
@@ -569,14 +569,14 @@ bool transformMinLengthToRepeat(NGHolder &g, ReportManager &rm) {
|
||||
return true;
|
||||
}
|
||||
|
||||
vector<NFAVertex> preds;
|
||||
vector<NFAVertex> predcs;
|
||||
vector<NFAEdge> dead;
|
||||
for (auto u : inv_adjacent_vertices_range(cyclic, g)) {
|
||||
DEBUG_PRINTF("pred %zu\n", g[u].index);
|
||||
if (u == cyclic) {
|
||||
continue;
|
||||
}
|
||||
preds.emplace_back(u);
|
||||
predcs.emplace_back(u);
|
||||
|
||||
// We want to delete the out-edges of each predecessor, but need to
|
||||
// make sure we don't delete the startDs self loop.
|
||||
@@ -589,7 +589,7 @@ bool transformMinLengthToRepeat(NGHolder &g, ReportManager &rm) {
|
||||
|
||||
remove_edges(dead, g);
|
||||
|
||||
assert(!preds.empty());
|
||||
assert(!predcs.empty());
|
||||
|
||||
const CharReach &cr = g[cyclic].char_reach;
|
||||
|
||||
@@ -597,14 +597,14 @@ bool transformMinLengthToRepeat(NGHolder &g, ReportManager &rm) {
|
||||
v = add_vertex(g);
|
||||
g[v].char_reach = cr;
|
||||
|
||||
for (auto u : preds) {
|
||||
for (auto u : predcs) {
|
||||
add_edge(u, v, g);
|
||||
}
|
||||
preds.clear();
|
||||
preds.emplace_back(v);
|
||||
predcs.clear();
|
||||
predcs.emplace_back(v);
|
||||
}
|
||||
assert(!preds.empty());
|
||||
for (auto u : preds) {
|
||||
for (auto u : predcs) {
|
||||
add_edge(u, cyclic, g);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user