From: Victor Julien Date: Fri, 22 Sep 2023 08:14:11 +0000 (+0200) Subject: detect/content: use const pointer where possible X-Git-Tag: suricata-8.0.0-beta1~1996 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8ba7f23c9bbb7de823df04643cb1acf66db76831;p=thirdparty%2Fsuricata.git detect/content: use const pointer where possible --- diff --git a/src/detect-engine-content-inspection.c b/src/detect-engine-content-inspection.c index 4569cd7139..242ad03fa1 100644 --- a/src/detect-engine-content-inspection.c +++ b/src/detect-engine-content-inspection.c @@ -126,8 +126,7 @@ int DetectEngineContentInspectionInternal(DetectEngineCtx *de_ctx, DetectEngineT /* \todo unify this which is phase 2 of payload inspection unification */ if (smd->type == DETECT_CONTENT) { - - DetectContentData *cd = (DetectContentData *)smd->ctx; + const DetectContentData *cd = (const DetectContentData *)smd->ctx; SCLogDebug("inspecting content %"PRIu32" buffer_len %"PRIu32, cd->id, buffer_len); /* we might have already have this content matched by the mpm. diff --git a/src/detect-replace.c b/src/detect-replace.c index 147c3e94d8..e70a2e1677 100644 --- a/src/detect-replace.c +++ b/src/detect-replace.c @@ -176,9 +176,8 @@ error: * earlier changes. Thus the highest priority modifications should be * applied last. */ -DetectReplaceList *DetectReplaceAddToList(DetectReplaceList *replist, - uint8_t *found, - DetectContentData *cd) +DetectReplaceList *DetectReplaceAddToList( + DetectReplaceList *replist, uint8_t *found, const DetectContentData *cd) { DetectReplaceList *newlist; diff --git a/src/detect-replace.h b/src/detect-replace.h index c444188c09..4944420527 100644 --- a/src/detect-replace.h +++ b/src/detect-replace.h @@ -26,7 +26,8 @@ #include "detect-content.h" -DetectReplaceList * DetectReplaceAddToList(DetectReplaceList *replist, uint8_t *found, DetectContentData *cd); +DetectReplaceList *DetectReplaceAddToList( + DetectReplaceList *replist, uint8_t *found, const DetectContentData *cd); /* Internal functions are only called via the inline functions below. */ void DetectReplaceExecuteInternal(Packet *p, DetectReplaceList *replist); diff --git a/src/detect.h b/src/detect.h index e30bac279a..53ca2b0931 100644 --- a/src/detect.h +++ b/src/detect.h @@ -721,7 +721,7 @@ typedef struct DetectPatternTracker { } DetectPatternTracker; typedef struct DetectReplaceList_ { - struct DetectContentData_ *cd; + const struct DetectContentData_ *cd; uint8_t *found; struct DetectReplaceList_ *next; } DetectReplaceList;