Various cppcheck fixes (#337)

This commit is contained in:
Konstantinos Margaritis
2025-05-30 12:27:28 +03:00
committed by GitHub
parent 4f40db0755
commit 7b505226ed
11 changed files with 31 additions and 29 deletions

View File

@@ -307,7 +307,7 @@ char lbrMatchLoop(const struct lbr_common *l, const u64a begin, const u64a end,
static really_inline
char lbrRevScanDot(UNUSED const struct NFA *nfa, UNUSED const u8 *buf,
UNUSED size_t begin, UNUSED size_t end,
UNUSED size_t *loc) {
UNUSED const size_t *loc) {
assert(begin <= end);
assert(nfa->type == LBR_NFA_DOT);
// Nothing can kill a dot!
@@ -413,7 +413,7 @@ char lbrRevScanTruf(const struct NFA *nfa, const u8 *buf,
static really_inline
char lbrFwdScanDot(UNUSED const struct NFA *nfa, UNUSED const u8 *buf,
UNUSED size_t begin, UNUSED size_t end,
UNUSED size_t *loc) {
UNUSED const size_t *loc) {
assert(begin <= end);
assert(nfa->type == LBR_NFA_DOT);
// Nothing can kill a dot!

View File

@@ -180,7 +180,7 @@ found_top:;
u64a ep = MIN(MIN(end, (s64a)q->length) + offset, first_match);
if (ep > sp && sp >= offset) {
size_t eloc;
size_t eloc = 0;
DEBUG_PRINTF("rev b%llu e%llu/%zu\n", sp - offset, ep - offset,
q->length);
assert(ep - offset <= q->length);

View File

@@ -662,7 +662,7 @@ void buildTugTrigger(NGHolder &g, NFAVertex cyclic, NFAVertex v,
}
static
NFAVertex createCyclic(NGHolder &g, ReachSubgraph &rsi) {
NFAVertex createCyclic(NGHolder &g, ReachSubgraph const &rsi) {
NFAVertex last = rsi.vertices.back();
NFAVertex cyclic = clone_vertex(g, last);
add_edge(cyclic, cyclic, g);
@@ -672,7 +672,7 @@ NFAVertex createCyclic(NGHolder &g, ReachSubgraph &rsi) {
}
static
NFAVertex createPos(NGHolder &g, ReachSubgraph &rsi) {
NFAVertex createPos(NGHolder &g, ReachSubgraph const &rsi) {
NFAVertex pos = add_vertex(g);
NFAVertex first = rsi.vertices.front();

View File

@@ -861,7 +861,7 @@ void dumpMultipathShufti(ofstream &os, u32 len, const u8 *lo, const u8 *hi,
os << endl;
}
#define PROGRAM_CASE(name) \
#define PROGRAM_CASE(name) \
case ROSE_INSTR_##name: { \
os << " " << std::setw(4) << std::setfill('0') << (pc - pc_base) \
<< ": " #name "\n"; \

View File

@@ -763,7 +763,7 @@ void makeRoleSetState(const unordered_map<RoseVertex, u32> &roleStateIndices,
static
void makePushDelayedInstructions(const RoseLiteralMap &literals,
ProgramBuild &prog_build,
ProgramBuild const &prog_build,
const flat_set<u32> &delayed_ids,
RoseProgram &program) {
vector<RoseInstrPushDelayed> delay_instructions;
@@ -903,7 +903,7 @@ void makeRoleCheckBounds(const RoseBuildImpl &build, RoseVertex v,
}
static
void makeRoleGroups(const RoseGraph &g, ProgramBuild &prog_build,
void makeRoleGroups(const RoseGraph &g, ProgramBuild const &prog_build,
RoseVertex v, RoseProgram &program) {
rose_group groups = g[v].groups;
if (!groups) {
@@ -1020,7 +1020,7 @@ bool makeRoleMask(const vector<LookEntry> &look, RoseProgram &program) {
}
static UNUSED
string convertMaskstoString(u8 *p, int byte_len) {
string convertMaskstoString(u8 const *p, int byte_len) {
string s;
for (int i = 0; i < byte_len; i++) {
u8 hi = *p >> 4;
@@ -1625,7 +1625,7 @@ bool hasDelayedLiteral(const RoseBuildImpl &build,
static
RoseProgram makeLitInitialProgram(const RoseBuildImpl &build,
ProgramBuild &prog_build, u32 lit_id,
ProgramBuild const &prog_build, u32 lit_id,
const vector<RoseEdge> &lit_edges,
bool is_anchored_replay_program) {
RoseProgram program;
@@ -2309,7 +2309,7 @@ RoseProgram makeLiteralProgram(const RoseBuildImpl &build,
}
RoseProgram makeDelayRebuildProgram(const RoseBuildImpl &build,
ProgramBuild &prog_build,
ProgramBuild const &prog_build,
const vector<u32> &lit_ids) {
assert(!lit_ids.empty());
assert(build.cc.streaming);

View File

@@ -243,7 +243,7 @@ RoseProgram makeLiteralProgram(const RoseBuildImpl &build,
bool is_anchored_replay_program);
RoseProgram makeDelayRebuildProgram(const RoseBuildImpl &build,
ProgramBuild &prog_build,
ProgramBuild const &prog_build,
const std::vector<u32> &lit_ids);
RoseProgram makeEodAnchorProgram(const RoseBuildImpl &build,