]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
next batch for cppeheck, addressing syntaxError and
authorG.E <gregory.economou@vectorcamp.gr>
Wed, 24 Apr 2024 14:32:09 +0000 (17:32 +0300)
committerG.E <gregory.economou@vectorcamp.gr>
Wed, 24 Apr 2024 14:32:09 +0000 (17:32 +0300)
constParameterPointer

12 files changed:
src/fdr/fdr.c
src/nfa/castle.c
src/nfa/goughcompile.cpp
src/nfa/limex_common_impl.h
src/nfa/limex_runtime_impl.h
src/nfa/mpv.c
src/rose/rose_build_matchers.cpp
src/rose/stream.c
src/scratch.h
src/som/som_runtime.c
tools/hsbench/main.cpp
unit/hyperscan/test_util.cpp

index 561e8f98662561619620ef5768bf114ec8803aac..16f453c589c6383e2bb2fb66cc6c4b79ff852370 100644 (file)
@@ -298,7 +298,7 @@ void get_conf_stride_4(const u8 *itPtr, UNUSED const u8 *start_ptr,
 static really_inline
 void do_confirm_fdr(u64a *conf, u8 offset, hwlmcb_rv_t *control,
                     const u32 *confBase, const struct FDR_Runtime_Args *a,
-                    const u8 *ptr, u32 *last_match_id, struct zone *z) {
+                    const u8 *ptr, u32 *last_match_id, const struct zone *z) {
     const u8 bucket = 8;
 
     if (likely(!*conf)) {
index 29208f8d47023e0428fd66c3dc1370d15ad6098c..4c1036361f09f263fe8b3ff00021ee99105b685a 100644 (file)
@@ -400,7 +400,7 @@ char castleFindMatch(const struct Castle *c, const u64a begin, const u64a end,
 }
 
 static really_inline
-u64a subCastleNextMatch(const struct Castle *c, void *full_state,
+u64a subCastleNextMatch(const struct Castle *c, const void *full_state,
                         void *stream_state, const u64a loc,
                         const u32 subIdx) {
     DEBUG_PRINTF("subcastle %u\n", subIdx);
index 59ef052fe8a2bba47f898e8f7c005915ec55e090..d703a32cb0cefca0d16ac8ffa6d99ec843c08432 100644 (file)
@@ -659,7 +659,7 @@ GoughSSAVar *GoughSSAVarJoin::get_input(const GoughEdge &prev) const {
 }
 
 const flat_set<GoughEdge> &GoughSSAVarJoin::get_edges_for_input(
-                                                 GoughSSAVar *input) const {
+                                                 const GoughSSAVar *input) const {
     return input_map.at(input);
 }
 
index e441945d70057442e36dc15d12c343f1772ea498..48661871746f6464c7fabd62841ca9fcd1805be5 100644 (file)
@@ -332,7 +332,7 @@ void EXPIRE_ESTATE_FN(const IMPL_NFA_T *limex, struct CONTEXT_T *ctx,
 // UE-1636) need to guard cyclic tug-accepts as well.
 static really_inline
 char LIMEX_INACCEPT_FN(const IMPL_NFA_T *limex, STATE_T state,
-                       union RepeatControl *repeat_ctrl, char *repeat_state,
+                       const union RepeatControl *repeat_ctrl, const char *repeat_state,
                        u64a offset, ReportID report) {
     assert(limex);
 
@@ -382,7 +382,7 @@ char LIMEX_INACCEPT_FN(const IMPL_NFA_T *limex, STATE_T state,
 
 static really_inline
 char LIMEX_INANYACCEPT_FN(const IMPL_NFA_T *limex, STATE_T state,
-                          union RepeatControl *repeat_ctrl, char *repeat_state,
+                          const union RepeatControl *repeat_ctrl, const char *repeat_state,
                           u64a offset) {
     assert(limex);
 
index 7b89182bea6d89abe11a91a67d4f9370589b47d8..b282ae1843fcd029ebdcb85f162b687df49c0763 100644 (file)
@@ -927,7 +927,7 @@ char JOIN(LIMEX_API_ROOT, _testEOD)(const struct NFA *n, const char *state,
                       context);
 }
 
-char JOIN(LIMEX_API_ROOT, _reportCurrent)(const struct NFA *n, struct mq *q) {
+char JOIN(LIMEX_API_ROOT, _reportCurrent)(const struct NFA *n, const struct mq *q) {
     const IMPL_NFA_T *limex = getImplNfa(n);
     REPORTCURRENT_FN(limex, q);
     return 1;
index cba3d159ee9417337102023d70d7c7c5984ecf55..62bdbdb9c0d5e2afcf1b399d894b7e18f17de4ce 100644 (file)
@@ -607,7 +607,7 @@ size_t find_last_bad(const struct mpv_kilopuff *kp, const u8 *buf,
 }
 
 static really_inline
-void restartKilo(const struct mpv *m, UNUSED u8 *active, u8 *reporters,
+void restartKilo(const struct mpv *m, UNUSED const u8 *active, u8 *reporters,
                  struct mpv_decomp_state *dstate, struct mpv_pq_item *pq,
                  const u8 *buf, u64a prev_limit, size_t buf_length, u32 i) {
     const struct mpv_kilopuff *kp = (const void *)(m + 1);
index aa7a794d57f632785edf77c959d4e9ebed38b738..3d68200f8fa3e6becaa0fbee541c559756a5f44a 100644 (file)
@@ -884,7 +884,7 @@ void buildAccel(const RoseBuildImpl &build,
 }
 
 bytecode_ptr<HWLM>
-buildHWLMMatcher(const RoseBuildImpl &build, LitProto *litProto) {
+buildHWLMMatcher(const RoseBuildImpl &build, const LitProto *litProto) {
     if (!litProto) {
         return nullptr;
     }
index 26268dd5741973386d09d4f23bac4a7f543f4055..acf4855a8c2f0ef448812b0cb2a1d4a2ea3a86f7 100644 (file)
@@ -104,7 +104,7 @@ void runAnchoredTableStream(const struct RoseEngine *t, const void *atable,
 
 
 static really_inline
-void saveStreamState(const struct NFA *nfa, struct mq *q, s64a loc) {
+void saveStreamState(const struct NFA *nfa, const struct mq *q, s64a loc) {
     DEBUG_PRINTF("offset=%llu, length=%zu, hlength=%zu, loc=%lld\n",
                  q->offset, q->length, q->hlength, loc);
     nfaQueueCompressState(nfa, q, loc);
index e3cd9245218831b3973e68883f0b0339feaa4c2a..e01ccd6b58538dbd4f116bcc251c8af266c3d726 100644 (file)
@@ -215,12 +215,12 @@ struct ALIGN_CL_DIRECTIVE hs_scratch {
 
 /* array of fatbit ptr; TODO: why not an array of fatbits? */
 static really_inline
-struct fatbit **getAnchoredLiteralLog(struct hs_scratch *scratch) {
+struct fatbit **getAnchoredLiteralLog(const struct hs_scratch *scratch) {
     return scratch->al_log;
 }
 
 static really_inline
-struct fatbit **getDelaySlots(struct hs_scratch *scratch) {
+struct fatbit **getDelaySlots(const struct hs_scratch *scratch) {
     return scratch->delay_slots;
 }
 
index 1a868efc974c65113d6465e3f975f7aa79fb1c0a..ce179ca059911925cfcc67854cc4e7a43949c881 100644 (file)
@@ -69,8 +69,8 @@ void setSomLoc(struct fatbit *som_set_now, u64a *som_store, u32 som_store_count,
 }
 
 static really_inline
-char ok_and_mark_if_write(u8 *som_store_valid, struct fatbit *som_set_now,
-                          u8 *som_store_writable, u32 som_store_count,
+char ok_and_mark_if_write(u8 *som_store_valid, const struct fatbit *som_set_now,
+                          const u8 *som_store_writable, u32 som_store_count,
                           u32 loc) {
     return !mmbit_set(som_store_valid, som_store_count, loc) /* unwritten */
         || fatbit_isset(som_set_now, som_store_count, loc) /* write here, need
@@ -79,7 +79,7 @@ char ok_and_mark_if_write(u8 *som_store_valid, struct fatbit *som_set_now,
 }
 
 static really_inline
-char ok_and_mark_if_unset(u8 *som_store_valid, struct fatbit *som_set_now,
+char ok_and_mark_if_unset(u8 *som_store_valid, const struct fatbit *som_set_now,
                           u32 som_store_count, u32 loc) {
     return !mmbit_set(som_store_valid, som_store_count, loc) /* unwritten */
         || fatbit_isset(som_set_now, som_store_count, loc); /* write here, need
index 1a19d510fe86d668b8ae3ddce4ea8335479caee1..8d9f8d6d3217f74838e89f69af1c3fe03d46a0c0 100644 (file)
@@ -465,7 +465,7 @@ void processArgs(int argc, char *argv[], vector<BenchmarkSigs> &sigSets,
 
 /** Start the global timer. */
 static
-void startTotalTimer(ThreadContext *ctx) {
+void startTotalTimer(const ThreadContext *ctx) {
     if (ctx->num != 0) {
         return; // only runs in the first thread
     }
@@ -474,7 +474,7 @@ void startTotalTimer(ThreadContext *ctx) {
 
 /** Stop the global timer and calculate totals. */
 static
-void stopTotalTimer(ThreadContext *ctx) {
+void stopTotalTimer(const ThreadContext *ctx) {
     if (ctx->num != 0) {
         return; // only runs in the first thread
     }
index f6c20a74e24ea96d003b3c5bdea0c40b7065c9e6..c7a26acd285bf0f863ae44bede6f9c6eec22013f 100644 (file)
@@ -58,7 +58,7 @@ std::ostream &operator<<(std::ostream &o, const pattern &p) {
 }
 
 hs_database_t *buildDB(const vector<pattern> &patterns, unsigned int mode,
-                       hs_platform_info *plat) {
+                       const hs_platform_info *plat) {
     vector<const char *> expressions;
     vector<unsigned int> flags;
     vector<unsigned int> ids;