From 8f72a04973764ea849096cec3ee828e7ce4891ec Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Fri, 12 Jan 2024 13:41:17 +0100 Subject: [PATCH] detect/alert: minor loop cleanup --- src/detect-engine-alert.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/detect-engine-alert.c b/src/detect-engine-alert.c index e0854c3782..bf6a760b88 100644 --- a/src/detect-engine-alert.c +++ b/src/detect-engine-alert.c @@ -376,10 +376,7 @@ void PacketAlertFinalize(DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx qsort(det_ctx->alert_queue, det_ctx->alert_queue_size, sizeof(PacketAlert), AlertQueueSortHelper); - uint16_t i = 0; - uint16_t max_pos = det_ctx->alert_queue_size; - - while (i < max_pos) { + for (uint16_t i = 0; i < det_ctx->alert_queue_size; i++) { PacketAlert *pa = &det_ctx->alert_queue[i]; const Signature *s = de_ctx->sig_array[pa->num]; int res = PacketAlertHandle(de_ctx, det_ctx, s, p, pa); @@ -420,13 +417,13 @@ void PacketAlertFinalize(DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx /* pass "alert" found, we're done */ if (pa->action & ACTION_PASS) { + SCLogDebug("sid:%u: is a pass rule, so break out of loop", s->id); break; } p->alerts.cnt++; } else { p->alerts.discarded++; } - i++; } /* At this point, we should have all the new alerts. Now check the tag -- 2.47.2