From eb112808886a857fc6868911dc2aef5a2d093e2b Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Wed, 10 Apr 2013 10:30:48 +0200 Subject: [PATCH] Use define instead of magic number for pmq's per detect thread --- src/detect-engine.c | 4 ++-- src/detect.h | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/detect-engine.c b/src/detect-engine.c index da13f39778..bf45329d8b 100644 --- a/src/detect-engine.c +++ b/src/detect-engine.c @@ -1069,7 +1069,7 @@ static TmEcode ThreadCtxDoInit (DetectEngineCtx *de_ctx, DetectEngineThreadCtx * PatternMatchThreadPrepare(&det_ctx->mtcu, de_ctx->mpm_matcher, DetectUricontentMaxId(de_ctx)); PmqSetup(&det_ctx->pmq, 0, de_ctx->max_fp_id); - for (i = 0; i < 256; i++) { + for (i = 0; i < DETECT_SMSG_PMQ_NUM; i++) { PmqSetup(&det_ctx->smsg_pmq[i], 0, de_ctx->max_fp_id); } @@ -1196,7 +1196,7 @@ TmEcode DetectEngineThreadCtxDeinit(ThreadVars *tv, void *data) { PmqFree(&det_ctx->pmq); int i; - for (i = 0; i < 256; i++) { + for (i = 0; i < DETECT_SMSG_PMQ_NUM; i++) { PmqFree(&det_ctx->smsg_pmq[i]); } diff --git a/src/detect.h b/src/detect.h index 480ce61e2f..dbbf90d06a 100644 --- a/src/detect.h +++ b/src/detect.h @@ -734,6 +734,8 @@ typedef struct HttpReassembledBody_ { } HttpReassembledBody; #define DETECT_FILESTORE_MAX 15 +/** \todo review how many we actually need here */ +#define DETECT_SMSG_PMQ_NUM 256 /** * Detection engine thread data. @@ -805,7 +807,7 @@ typedef struct DetectionEngineThreadCtx_ { MpmThreadCtx mtcu; /**< thread ctx for uricontent mpm */ MpmThreadCtx mtcs; /**< thread ctx for stream mpm */ PatternMatcherQueue pmq; - PatternMatcherQueue smsg_pmq[256]; + PatternMatcherQueue smsg_pmq[DETECT_SMSG_PMQ_NUM]; /** ip only rules ctx */ DetectEngineIPOnlyThreadCtx io_ctx;