]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect: packet match micro optimization
authorVictor Julien <victor@inliniac.net>
Sat, 16 Mar 2019 06:34:40 +0000 (07:34 +0100)
committerVictor Julien <victor@inliniac.net>
Thu, 21 Mar 2019 18:19:04 +0000 (19:19 +0100)
src/detect.c

index d1ecf9501da759a08a06126f6e56673b0c114dfa..b7c5aa26fc4d198e4e18f32c429bc982954d1c29 100644 (file)
@@ -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;