From: Victor Julien Date: Sat, 16 Mar 2019 06:34:40 +0000 (+0100) Subject: detect: packet match micro optimization X-Git-Tag: suricata-5.0.0-beta1~128 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bd31e4e3320f74e67bf79d878979bb927af3e8ba;p=thirdparty%2Fsuricata.git detect: packet match micro optimization --- diff --git a/src/detect.c b/src/detect.c index d1ecf9501d..b7c5aa26fc 100644 --- a/src/detect.c +++ b/src/detect.c @@ -672,21 +672,19 @@ static inline int DetectRunInspectRulePacketMatches( SigMatchData *smd = s->sm_arrays[DETECT_SM_LIST_MATCH]; SCLogDebug("running match functions, sm %p", smd); - if (smd != NULL) { - while (1) { - KEYWORD_PROFILING_START; - if (sigmatch_table[smd->type].Match(tv, det_ctx, p, s, smd->ctx) <= 0) { - KEYWORD_PROFILING_END(det_ctx, smd->type, 0); - SCLogDebug("no match"); - return 0; - } - KEYWORD_PROFILING_END(det_ctx, smd->type, 1); - if (smd->is_last) { - SCLogDebug("match and is_last"); - break; - } - smd++; + while (1) { + KEYWORD_PROFILING_START; + if (sigmatch_table[smd->type].Match(tv, det_ctx, p, s, smd->ctx) <= 0) { + KEYWORD_PROFILING_END(det_ctx, smd->type, 0); + SCLogDebug("no match"); + return 0; } + KEYWORD_PROFILING_END(det_ctx, smd->type, 1); + if (smd->is_last) { + SCLogDebug("match and is_last"); + break; + } + smd++; } } return 1;