mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-06-28 16:41:01 +03:00
Merge pull request #255 from isildur-g/wip-isildur-g
addressing some cppcheck warnings.
This commit is contained in:
commit
db07cddaec
@ -117,7 +117,7 @@ static void run_benchmarks(int size, int loops, int max_matches,
|
|||||||
std::chrono::duration_cast<std::chrono::microseconds>(end - start)
|
std::chrono::duration_cast<std::chrono::microseconds>(end - start)
|
||||||
.count();
|
.count();
|
||||||
/*calculate transferred size*/
|
/*calculate transferred size*/
|
||||||
total_size = size * loops;
|
total_size = (u64a)size * (u64a)loops;
|
||||||
/*calculate average time*/
|
/*calculate average time*/
|
||||||
avg_time = total_sec / loops;
|
avg_time = total_sec / loops;
|
||||||
/*convert microseconds to seconds*/
|
/*convert microseconds to seconds*/
|
||||||
|
@ -193,9 +193,6 @@ void reduceGraph(NGHolder &g, som_type som, bool utf8,
|
|||||||
|
|
||||||
if (!som) {
|
if (!som) {
|
||||||
mergeCyclicDotStars(g);
|
mergeCyclicDotStars(g);
|
||||||
}
|
|
||||||
|
|
||||||
if (!som) {
|
|
||||||
removeSiblingsOfStartDotStar(g);
|
removeSiblingsOfStartDotStar(g);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -811,11 +811,9 @@ depth_done:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Second option: a two-byte shufti (i.e. less than eight 2-byte
|
// Second option: a two-byte shufti (i.e. less than eight 2-byte
|
||||||
// literals)
|
// literals)
|
||||||
if (depth > 1) {
|
|
||||||
for (unsigned int i = 0; i < (depth - 1); i++) {
|
for (unsigned int i = 0; i < (depth - 1); i++) {
|
||||||
if (depthReach[i].count() * depthReach[i+1].count()
|
if (depthReach[i].count() * depthReach[i+1].count()
|
||||||
<= DOUBLE_SHUFTI_LIMIT) {
|
<= DOUBLE_SHUFTI_LIMIT) {
|
||||||
|
@ -267,18 +267,6 @@ bool somMayGoBackwards(NFAVertex u, const NGHolder &g,
|
|||||||
boost::depth_first_search(c_g, visitor(backEdgeVisitor)
|
boost::depth_first_search(c_g, visitor(backEdgeVisitor)
|
||||||
.root_vertex(c_g.start));
|
.root_vertex(c_g.start));
|
||||||
|
|
||||||
for (const auto &e : be) {
|
|
||||||
NFAVertex s = source(e, c_g);
|
|
||||||
NFAVertex t = target(e, c_g);
|
|
||||||
DEBUG_PRINTF("back edge %zu %zu\n", c_g[s].index, c_g[t].index);
|
|
||||||
if (s != t) {
|
|
||||||
assert(0);
|
|
||||||
DEBUG_PRINTF("eek big cycle\n");
|
|
||||||
rv = true; /* big cycle -> eek */
|
|
||||||
goto exit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DEBUG_PRINTF("checking acyclic+selfloop graph\n");
|
DEBUG_PRINTF("checking acyclic+selfloop graph\n");
|
||||||
|
|
||||||
rv = !firstMatchIsFirst(c_g);
|
rv = !firstMatchIsFirst(c_g);
|
||||||
|
@ -2975,7 +2975,8 @@ void buildFragmentPrograms(const RoseBuildImpl &build,
|
|||||||
!lit_prog.empty()) {
|
!lit_prog.empty()) {
|
||||||
auto &cfrag = fragments[pfrag.included_frag_id];
|
auto &cfrag = fragments[pfrag.included_frag_id];
|
||||||
assert(pfrag.s.length() >= cfrag.s.length() &&
|
assert(pfrag.s.length() >= cfrag.s.length() &&
|
||||||
!pfrag.s.any_nocase() >= !cfrag.s.any_nocase());
|
!pfrag.s.any_nocase() == !cfrag.s.any_nocase());
|
||||||
|
/** !pfrag.s.any_nocase() >= !cfrag.s.any_nocase()); **/
|
||||||
u32 child_offset = cfrag.lit_program_offset;
|
u32 child_offset = cfrag.lit_program_offset;
|
||||||
DEBUG_PRINTF("child %u offset %u\n", cfrag.fragment_id,
|
DEBUG_PRINTF("child %u offset %u\n", cfrag.fragment_id,
|
||||||
child_offset);
|
child_offset);
|
||||||
@ -2993,7 +2994,8 @@ void buildFragmentPrograms(const RoseBuildImpl &build,
|
|||||||
if (pfrag.included_delay_frag_id != INVALID_FRAG_ID &&
|
if (pfrag.included_delay_frag_id != INVALID_FRAG_ID &&
|
||||||
!rebuild_prog.empty()) {
|
!rebuild_prog.empty()) {
|
||||||
auto &cfrag = fragments[pfrag.included_delay_frag_id];
|
auto &cfrag = fragments[pfrag.included_delay_frag_id];
|
||||||
assert(pfrag.s.length() >= cfrag.s.length() &&
|
/** assert(pfrag.s.length() >= cfrag.s.length() && **/
|
||||||
|
assert(pfrag.s.length() == cfrag.s.length() &&
|
||||||
!pfrag.s.any_nocase() >= !cfrag.s.any_nocase());
|
!pfrag.s.any_nocase() >= !cfrag.s.any_nocase());
|
||||||
u32 child_offset = cfrag.delay_program_offset;
|
u32 child_offset = cfrag.delay_program_offset;
|
||||||
DEBUG_PRINTF("child %u offset %u\n", cfrag.fragment_id,
|
DEBUG_PRINTF("child %u offset %u\n", cfrag.fragment_id,
|
||||||
|
@ -170,7 +170,6 @@ void renovateCastle(RoseBuildImpl &tbi, CastleProto *castle,
|
|||||||
return; /* bail - TODO: be less lazy */
|
return; /* bail - TODO: be less lazy */
|
||||||
}
|
}
|
||||||
|
|
||||||
vector<CharReach> rem_local_cr;
|
|
||||||
u32 ok_count = 0;
|
u32 ok_count = 0;
|
||||||
for (auto it = e.s.end() - g[v].left.lag; it != e.s.end(); ++it) {
|
for (auto it = e.s.end() - g[v].left.lag; it != e.s.end(); ++it) {
|
||||||
if (!isSubsetOf(*it, cr)) {
|
if (!isSubsetOf(*it, cr)) {
|
||||||
|
@ -97,12 +97,12 @@ unsigned int countFailures = 0;
|
|||||||
|
|
||||||
class ParsedExpr {
|
class ParsedExpr {
|
||||||
public:
|
public:
|
||||||
ParsedExpr(string regex_in, unsigned int flags_in, hs_expr_ext ext_in)
|
ParsedExpr(string regex_in, unsigned int flags_in, const hs_expr_ext& ext_in)
|
||||||
: regex(regex_in), flags(flags_in), ext(ext_in) {}
|
: regex(regex_in), flags(flags_in), ext(ext_in) {}
|
||||||
~ParsedExpr() {}
|
~ParsedExpr() {}
|
||||||
string regex;
|
string regex;
|
||||||
unsigned int flags;
|
unsigned int flags;
|
||||||
hs_expr_ext ext;
|
const hs_expr_ext& ext;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef map<unsigned int, ParsedExpr> ExprExtMap;
|
typedef map<unsigned int, ParsedExpr> ExprExtMap;
|
||||||
|
@ -152,7 +152,6 @@ bool HS_CDECL readExpression(const std::string &input, std::string &expr,
|
|||||||
UNUSED const char *eof = pe;
|
UNUSED const char *eof = pe;
|
||||||
UNUSED const char *ts = p, *te = p;
|
UNUSED const char *ts = p, *te = p;
|
||||||
int cs;
|
int cs;
|
||||||
UNUSED int act;
|
|
||||||
|
|
||||||
assert(p);
|
assert(p);
|
||||||
assert(pe);
|
assert(pe);
|
||||||
|
@ -47,7 +47,7 @@ class NGHolder;
|
|||||||
} // namespace ue2
|
} // namespace ue2
|
||||||
|
|
||||||
struct CorpusGenerationFailure {
|
struct CorpusGenerationFailure {
|
||||||
explicit CorpusGenerationFailure(const std::string s) :
|
explicit CorpusGenerationFailure(const std::string& s) :
|
||||||
message(std::move(s)) {}
|
message(std::move(s)) {}
|
||||||
std::string message;
|
std::string message;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user