Merge pull request #264 from gtsoul-tech/bugFix/cppcheck-constVariablePointer

Cppcheck constVariablePointer error
This commit is contained in:
Konstantinos Margaritis
2024-05-08 10:28:24 +03:00
committed by GitHub
32 changed files with 101 additions and 101 deletions

View File

@@ -227,7 +227,7 @@ int roseBlockFloating(const struct RoseEngine *t, struct hs_scratch *scratch) {
const size_t length = scratch->core_info.len;
char *state = scratch->core_info.state;
struct RoseContext *tctxt = &scratch->tctxt;
const struct RoseContext *tctxt = &scratch->tctxt;
DEBUG_PRINTF("ftable fd=%u fmd %u\n", t->floatingDistance,
t->floatingMinDistance);
@@ -377,7 +377,7 @@ void roseBlockExec(const struct RoseEngine *t, struct hs_scratch *scratch) {
init_for_block(t, scratch, state, is_small_block);
struct RoseContext *tctxt = &scratch->tctxt;
const struct RoseContext *tctxt = &scratch->tctxt;
if (is_small_block) {
const void *sbtable = getSBLiteralMatcher(t);

View File

@@ -679,7 +679,7 @@ hwlmcb_rv_t buildSufPQ(const struct RoseEngine *t, char *state, s64a safe_loc,
s64a final_loc, struct hs_scratch *scratch) {
assert(scratch->catchup_pq.qm_size <= t->outfixEndQueue);
struct RoseContext *tctxt = &scratch->tctxt;
const struct RoseContext *tctxt = &scratch->tctxt;
assert(t->activeArrayCount);
assert(scratch->core_info.buf_offset + final_loc

View File

@@ -68,7 +68,7 @@ void printMatch(const struct core_info *ci, u64a start, u64a end) {
hwlmcb_rv_t roseDelayRebuildCallback(size_t end, u32 id,
struct hs_scratch *scratch) {
struct RoseContext *tctx = &scratch->tctxt;
const struct RoseContext *tctx = &scratch->tctxt;
struct core_info *ci = &scratch->core_info;
const struct RoseEngine *t = ci->rose;
size_t rb_len = MIN(ci->hlen, t->delayRebuildLength);
@@ -296,7 +296,7 @@ hwlmcb_rv_t flushAnchoredLiteralAtLoc(const struct RoseEngine *t,
struct hs_scratch *scratch,
u32 curr_loc) {
struct RoseContext *tctxt = &scratch->tctxt;
struct fatbit *curr_row = getAnchoredLiteralLog(scratch)[curr_loc - 1];
const struct fatbit *curr_row = getAnchoredLiteralLog(scratch)[curr_loc - 1];
u32 region_width = t->anchored_count;
const u32 *programs = getByOffset(t, t->anchoredProgramOffset);
@@ -334,7 +334,7 @@ hwlmcb_rv_t flushAnchoredLiteralAtLoc(const struct RoseEngine *t,
static really_inline
u32 anchored_it_begin(struct hs_scratch *scratch) {
struct RoseContext *tctxt = &scratch->tctxt;
const struct RoseContext *tctxt = &scratch->tctxt;
if (tctxt->lastEndOffset >= scratch->anchored_literal_region_len) {
return MMB_INVALID;
}

View File

@@ -254,8 +254,8 @@ void roseFlushLastByteHistory(const struct RoseEngine *t,
return;
}
struct RoseContext *tctxt = &scratch->tctxt;
struct core_info *ci = &scratch->core_info;
const struct RoseContext *tctxt = &scratch->tctxt;
const struct core_info *ci = &scratch->core_info;
/* currEnd is last byte of string + 1 */
if (tctxt->lastEndOffset == ci->buf_offset + ci->len

View File

@@ -896,7 +896,7 @@ buildAnchoredMatcher(RoseBuildImpl &build, const vector<LitFragment> &fragments,
for (size_t i = 0; i < nfas.size(); i++) {
const NFA *nfa = nfas[i].get();
anchored_matcher_info *ami = (anchored_matcher_info *)curr;
char *prev_curr = curr;
const char *prev_curr = curr;
curr += sizeof(anchored_matcher_info);

View File

@@ -1186,8 +1186,8 @@ bool mergeLeftVL_tryMergeCandidate(RoseBuildImpl &build, left_id &r1,
assert(!r1.graph() == !r2.graph());
if (r1.graph()) {
NGHolder *h1 = r1.graph();
NGHolder *h2 = r2.graph();
const NGHolder *h1 = r1.graph();
const NGHolder *h2 = r2.graph();
CharReach stop1 = findStopAlphabet(*h1, SOM_NONE);
CharReach stop2 = findStopAlphabet(*h2, SOM_NONE);
CharReach stopboth = stop1 & stop2;

View File

@@ -382,7 +382,7 @@ void roseSaveNfaStreamState(const struct RoseEngine *t, char *state,
qi = mmbit_iterate(aa, aaCount, qi)) {
DEBUG_PRINTF("saving stream state for qi=%u\n", qi);
struct mq *q = queues + qi;
const struct mq *q = queues + qi;
// If it's active, it should have an active queue (as we should have
// done some work!)
@@ -517,7 +517,7 @@ void runEagerPrefixesStream(const struct RoseEngine *t,
static really_inline
int can_never_match(const struct RoseEngine *t, char *state,
struct hs_scratch *scratch, size_t length, u64a offset) {
struct RoseContext *tctxt = &scratch->tctxt;
const struct RoseContext *tctxt = &scratch->tctxt;
if (tctxt->groups) {
DEBUG_PRINTF("still has active groups\n");

View File

@@ -332,7 +332,7 @@ void storeLongLiteralState(const struct RoseEngine *t, char *state,
return;
}
struct core_info *ci = &scratch->core_info;
const struct core_info *ci = &scratch->core_info;
const struct RoseLongLitTable *ll_table =
getByOffset(t, t->longLitTableOffset);
assert(ll_table->maxLen);