]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
profiling/rules: minor code cleanup
authorVictor Julien <vjulien@oisf.net>
Fri, 12 May 2023 12:09:10 +0000 (14:09 +0200)
committerVictor Julien <vjulien@oisf.net>
Fri, 12 May 2023 17:52:15 +0000 (19:52 +0200)
src/util-profiling-rules.c

index ded04c33ce7c516e469484760329dfd23c8019c6..90c1b8e57f48fcfc0ebadc24e34832d0406fcc58 100644 (file)
@@ -600,14 +600,13 @@ void SCProfilingRuleThreadSetup(SCProfileDetectCtx *ctx, DetectEngineThreadCtx *
 }
 
 static void SCProfilingRuleThreadMerge(
-        DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx, int reset)
+        DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx, bool reset)
 {
     if (de_ctx == NULL || de_ctx->profile_ctx == NULL || de_ctx->profile_ctx->data == NULL ||
             det_ctx == NULL || det_ctx->rule_perf_data == NULL)
         return;
 
-    int i;
-    for (i = 0; i < det_ctx->rule_perf_data_size; i++) {
+    for (int i = 0; i < det_ctx->rule_perf_data_size; i++) {
         de_ctx->profile_ctx->data[i].checks += det_ctx->rule_perf_data[i].checks;
         de_ctx->profile_ctx->data[i].matches += det_ctx->rule_perf_data[i].matches;
         de_ctx->profile_ctx->data[i].ticks_match += det_ctx->rule_perf_data[i].ticks_match;
@@ -629,7 +628,7 @@ void SCProfilingRuleThreadCleanup(DetectEngineThreadCtx *det_ctx)
         return;
 
     pthread_mutex_lock(&det_ctx->de_ctx->profile_ctx->data_m);
-    SCProfilingRuleThreadMerge(det_ctx->de_ctx, det_ctx, 0);
+    SCProfilingRuleThreadMerge(det_ctx->de_ctx, det_ctx, false);
     pthread_mutex_unlock(&det_ctx->de_ctx->profile_ctx->data_m);
 
     SCFree(det_ctx->rule_perf_data);
@@ -643,7 +642,7 @@ void SCProfilingRuleThreatAggregate(DetectEngineThreadCtx *det_ctx)
     if (det_ctx == NULL || det_ctx->de_ctx == NULL || det_ctx->de_ctx->profile_ctx == NULL)
         return;
     pthread_mutex_lock(&det_ctx->de_ctx->profile_ctx->data_m);
-    SCProfilingRuleThreadMerge(det_ctx->de_ctx, det_ctx, 1);
+    SCProfilingRuleThreadMerge(det_ctx->de_ctx, det_ctx, true);
     pthread_mutex_unlock(&det_ctx->de_ctx->profile_ctx->data_m);
 }