]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect/app-layer-events: constify arguments; minor cleanups
authorVictor Julien <vjulien@oisf.net>
Wed, 27 Sep 2023 10:23:23 +0000 (12:23 +0200)
committerVictor Julien <victor@inliniac.net>
Fri, 1 Dec 2023 13:55:42 +0000 (14:55 +0100)
src/app-layer-events.h
src/detect-app-layer-event.c

index 83cb0d9ba47180648f589bb019c42d7232857b31..8b0dc8276d61642c499f9860059299e61e6db42c 100644 (file)
@@ -59,15 +59,14 @@ int AppLayerGetEventInfoById(int event_id, const char **event_name,
                              AppLayerEventType *event_type);
 void AppLayerDecoderEventsSetEventRaw(AppLayerDecoderEvents **sevents, uint8_t event);
 
-static inline int AppLayerDecoderEventsIsEventSet(AppLayerDecoderEvents *devents,
-                                                  uint8_t event)
+static inline int AppLayerDecoderEventsIsEventSet(
+        const AppLayerDecoderEvents *devents, uint8_t event)
 {
     if (devents == NULL)
         return 0;
 
-    int i;
     int cnt = devents->cnt;
-    for (i = 0; i < cnt; i++) {
+    for (int i = 0; i < cnt; i++) {
         if (devents->events[i] == event)
             return 1;
     }
index d5eb0117218e5abbdcaf71b654232b6c9c3cb9f9..9c323359b57743ad2090a2c73d82e8810bd0ed4c 100644 (file)
@@ -92,14 +92,14 @@ static uint8_t DetectEngineAptEventInspect(DetectEngineCtx *de_ctx, DetectEngine
 {
     int r = 0;
     const AppProto alproto = f->alproto;
-    AppLayerDecoderEvents *decoder_events =
-        AppLayerParserGetEventsByTx(f->proto, alproto, tx);
+    const AppLayerDecoderEvents *decoder_events =
+            AppLayerParserGetEventsByTx(f->proto, alproto, tx);
     if (decoder_events == NULL) {
         goto end;
     }
-    SigMatchData *smd = engine->smd;
+    const SigMatchData *smd = engine->smd;
     while (1) {
-        DetectAppLayerEventData *aled = (DetectAppLayerEventData *)smd->ctx;
+        const DetectAppLayerEventData *aled = (const DetectAppLayerEventData *)smd->ctx;
         KEYWORD_PROFILING_START;
 
         if (AppLayerDecoderEventsIsEventSet(decoder_events, aled->event_id)) {