mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-11-17 09:45:28 +03:00
Merge pull request #263 from gtsoul-tech/bug/cppcheck-61
Cppcheck knownConditionTrueFalse error
This commit is contained in:
@@ -1687,7 +1687,7 @@ void replaceTops(NGHolder &h, const map<u32, u32> &top_mapping) {
|
||||
}
|
||||
|
||||
static
|
||||
bool setDistinctTops(NGHolder &h1, const NGHolder &h2,
|
||||
void setDistinctTops(NGHolder &h1, const NGHolder &h2,
|
||||
map<u32, u32> &top_mapping) {
|
||||
flat_set<u32> tops1 = getTops(h1), tops2 = getTops(h2);
|
||||
|
||||
@@ -1697,7 +1697,7 @@ bool setDistinctTops(NGHolder &h1, const NGHolder &h2,
|
||||
// If our tops don't intersect, we're OK to merge with no changes.
|
||||
if (!has_intersection(tops1, tops2)) {
|
||||
DEBUG_PRINTF("tops don't intersect\n");
|
||||
return true;
|
||||
return ;
|
||||
}
|
||||
|
||||
// Otherwise, we have to renumber the tops in h1 so that they don't overlap
|
||||
@@ -1712,18 +1712,17 @@ bool setDistinctTops(NGHolder &h1, const NGHolder &h2,
|
||||
}
|
||||
|
||||
replaceTops(h1, top_mapping);
|
||||
return true;
|
||||
return ;
|
||||
}
|
||||
|
||||
bool setDistinctRoseTops(RoseGraph &g, NGHolder &h1, const NGHolder &h2,
|
||||
void setDistinctRoseTops(RoseGraph &g, NGHolder &h1, const NGHolder &h2,
|
||||
const deque<RoseVertex> &verts1) {
|
||||
map<u32, u32> top_mapping;
|
||||
if (!setDistinctTops(h1, h2, top_mapping)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
setDistinctTops(h1, h2, top_mapping);
|
||||
|
||||
if (top_mapping.empty()) {
|
||||
return true; // No remapping necessary.
|
||||
return ; // No remapping necessary.
|
||||
}
|
||||
|
||||
for (auto v : verts1) {
|
||||
@@ -1741,19 +1740,17 @@ bool setDistinctRoseTops(RoseGraph &g, NGHolder &h1, const NGHolder &h2,
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return ;
|
||||
}
|
||||
|
||||
static
|
||||
bool setDistinctSuffixTops(RoseGraph &g, NGHolder &h1, const NGHolder &h2,
|
||||
void setDistinctSuffixTops(RoseGraph &g, NGHolder &h1, const NGHolder &h2,
|
||||
const deque<RoseVertex> &verts1) {
|
||||
map<u32, u32> top_mapping;
|
||||
if (!setDistinctTops(h1, h2, top_mapping)) {
|
||||
return false;
|
||||
}
|
||||
setDistinctTops(h1, h2, top_mapping);
|
||||
|
||||
if (top_mapping.empty()) {
|
||||
return true; // No remapping necessary.
|
||||
return ; // No remapping necessary.
|
||||
}
|
||||
|
||||
for (auto v : verts1) {
|
||||
@@ -1763,7 +1760,7 @@ bool setDistinctSuffixTops(RoseGraph &g, NGHolder &h1, const NGHolder &h2,
|
||||
g[v].suffix.top = top_mapping[t];
|
||||
}
|
||||
|
||||
return true;
|
||||
return ;
|
||||
}
|
||||
|
||||
/** \brief Estimate the number of accel states in the given graph when built as
|
||||
@@ -1837,10 +1834,7 @@ void mergeNfaLeftfixes(RoseBuildImpl &tbi, LeftfixBouquet &roses) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!setDistinctRoseTops(g, victim, *r1.graph(), verts2)) {
|
||||
DEBUG_PRINTF("can't set distinct tops\n");
|
||||
continue; // next h2
|
||||
}
|
||||
setDistinctRoseTops(g, victim, *r1.graph(), verts2);
|
||||
|
||||
assert(victim.kind == r1.graph()->kind);
|
||||
assert(!generates_callbacks(*r1.graph()));
|
||||
@@ -2120,10 +2114,7 @@ void mergeSuffixes(RoseBuildImpl &tbi, SuffixBouquet &suffixes,
|
||||
old_tops[v] = g[v].suffix.top;
|
||||
}
|
||||
|
||||
if (!setDistinctSuffixTops(g, victim, *s1.graph(), verts2)) {
|
||||
DEBUG_PRINTF("can't set distinct tops\n");
|
||||
continue; // next h2
|
||||
}
|
||||
setDistinctSuffixTops(g, victim, *s1.graph(), verts2);
|
||||
|
||||
if (!mergeNfaPair(victim, *s1.graph(), &tbi.rm, tbi.cc)) {
|
||||
DEBUG_PRINTF("merge failed\n");
|
||||
|
||||
Reference in New Issue
Block a user