mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-11-16 17:31:51 +03:00
Fix marked as false positive knownConditionTrueFalse cppcheck warnings
std::make_shared<> does not return null, it throws std::bad_alloc.
This commit is contained in:
@@ -2445,10 +2445,6 @@ static
|
||||
bool doLitHaigSom(NG &ng, const NGHolder &g, som_type som) {
|
||||
ue2_literal lit;
|
||||
shared_ptr<NGHolder> rhs = make_shared<NGHolder>();
|
||||
if (!rhs) {
|
||||
assert(0);
|
||||
throw std::bad_alloc();
|
||||
}
|
||||
if (!ng.cc.grey.allowLitHaig) {
|
||||
return false;
|
||||
}
|
||||
@@ -2513,10 +2509,6 @@ bool doHaigLitHaigSom(NG &ng, NGHolder &g,
|
||||
ue2_literal lit;
|
||||
shared_ptr<NGHolder> rhs = make_shared<NGHolder>();
|
||||
shared_ptr<NGHolder> lhs = make_shared<NGHolder>();
|
||||
if (!rhs || !lhs) {
|
||||
assert(0);
|
||||
throw std::bad_alloc();
|
||||
}
|
||||
|
||||
if (!splitOffBestLiteral(g, regions, &lit, &*lhs, &*rhs, ng.cc)) {
|
||||
return false;
|
||||
|
||||
@@ -1035,11 +1035,6 @@ bool splitRoseEdge(const NGHolder &base_graph, RoseInGraph &vg,
|
||||
shared_ptr<NGHolder> lhs = make_shared<NGHolder>();
|
||||
shared_ptr<NGHolder> rhs = make_shared<NGHolder>();
|
||||
|
||||
if (!lhs || !rhs) {
|
||||
assert(0);
|
||||
throw std::bad_alloc();
|
||||
}
|
||||
|
||||
unordered_map<NFAVertex, NFAVertex> lhs_map;
|
||||
unordered_map<NFAVertex, NFAVertex> rhs_map;
|
||||
|
||||
@@ -1233,10 +1228,6 @@ void splitEdgesByCut(const NGHolder &h, RoseInGraph &vg,
|
||||
DEBUG_PRINTF("splitting on pivot %zu\n", h[pivot].index);
|
||||
unordered_map<NFAVertex, NFAVertex> temp_map;
|
||||
shared_ptr<NGHolder> new_lhs = make_shared<NGHolder>();
|
||||
if (!new_lhs) {
|
||||
assert(0);
|
||||
throw std::bad_alloc();
|
||||
}
|
||||
splitLHS(h, pivot, new_lhs.get(), &temp_map);
|
||||
|
||||
/* want to cut off paths to pivot from things other than the pivot -
|
||||
@@ -1318,10 +1309,7 @@ void splitEdgesByCut(const NGHolder &h, RoseInGraph &vg,
|
||||
if (!contains(done_rhs, adj)) {
|
||||
unordered_map<NFAVertex, NFAVertex> temp_map;
|
||||
shared_ptr<NGHolder> new_rhs = make_shared<NGHolder>();
|
||||
if (!new_rhs) {
|
||||
assert(0);
|
||||
throw std::bad_alloc();
|
||||
}
|
||||
|
||||
splitRHS(h, adj, new_rhs.get(), &temp_map);
|
||||
remove_edge(new_rhs->start, new_rhs->accept, *new_rhs);
|
||||
remove_edge(new_rhs->start, new_rhs->acceptEod, *new_rhs);
|
||||
@@ -2293,10 +2281,7 @@ void splitEdgesForSuffix(const NGHolder &base_graph, RoseInGraph &vg,
|
||||
assert(!splitters.empty());
|
||||
|
||||
shared_ptr<NGHolder> lhs = make_shared<NGHolder>();
|
||||
if (!lhs) {
|
||||
assert(0);
|
||||
throw bad_alloc();
|
||||
}
|
||||
|
||||
unordered_map<NFAVertex, NFAVertex> v_map;
|
||||
cloneHolder(*lhs, base_graph, &v_map);
|
||||
lhs->kind = NFA_INFIX;
|
||||
|
||||
Reference in New Issue
Block a user