]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
tm-modules: minor code cleanups 11880/head
authorJason Ish <jason.ish@oisf.net>
Fri, 4 Oct 2024 23:21:34 +0000 (17:21 -0600)
committerJason Ish <jason.ish@oisf.net>
Fri, 4 Oct 2024 23:24:00 +0000 (17:24 -0600)
- includes
- loops

src/tm-modules.c

index dbab61fa8895bc4b10870196056e127758101e8c..0b3212eb74256d2d9de1f5cd8f44fc775fa6217a 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2007-2010 Open Information Security Foundation
+/* Copyright (C) 2007-2024 Open Information Security Foundation
  *
  * You can copy, redistribute or modify this Program under the terms of
  * the GNU General Public License version 2 as published by the Free
  * Thread Module functions
  */
 
-#include "suricata-common.h"
-#include "packet-queue.h"
-#include "tm-threads.h"
+#include "tm-modules.h"
 #include "util-debug.h"
-#include "threads.h"
-#include "util-logopenfile.h"
 
 TmModule tmm_modules[TMM_SIZE];
 
 void TmModuleDebugList(void)
 {
-    TmModule *t;
-    uint16_t i;
-
-    for (i = 0; i < TMM_SIZE; i++) {
-        t = &tmm_modules[i];
+    for (uint16_t i = 0; i < TMM_SIZE; i++) {
+        TmModule *t = &tmm_modules[i];
 
         if (t->name == NULL)
             continue;
@@ -52,11 +45,8 @@ void TmModuleDebugList(void)
  *  \retval ptr to the module or NULL */
 TmModule *TmModuleGetByName(const char *name)
 {
-    TmModule *t;
-    uint16_t i;
-
-    for (i = 0; i < TMM_SIZE; i++) {
-        t = &tmm_modules[i];
+    for (uint16_t i = 0; i < TMM_SIZE; i++) {
+        TmModule *t = &tmm_modules[i];
 
         if (t->name == NULL)
             continue;
@@ -78,7 +68,6 @@ TmModule *TmModuleGetByName(const char *name)
  */
 TmModule *TmModuleGetById(int id)
 {
-
     if (id < 0 || id >= TMM_SIZE) {
         SCLogError("Threading module with the id "
                    "\"%d\" doesn't exist",
@@ -98,11 +87,8 @@ TmModule *TmModuleGetById(int id)
  */
 int TmModuleGetIDForTM(TmModule *tm)
 {
-    TmModule *t;
-    int i;
-
-    for (i = 0; i < TMM_SIZE; i++) {
-        t = &tmm_modules[i];
+    for (uint16_t i = 0; i < TMM_SIZE; i++) {
+        TmModule *t = &tmm_modules[i];
 
         if (t->name == NULL)
             continue;
@@ -117,11 +103,8 @@ int TmModuleGetIDForTM(TmModule *tm)
 
 void TmModuleRunInit(void)
 {
-    TmModule *t;
-    uint16_t i;
-
-    for (i = 0; i < TMM_SIZE; i++) {
-        t = &tmm_modules[i];
+    for (uint16_t i = 0; i < TMM_SIZE; i++) {
+        TmModule *t = &tmm_modules[i];
 
         if (t->name == NULL)
             continue;
@@ -135,11 +118,8 @@ void TmModuleRunInit(void)
 
 void TmModuleRunDeInit(void)
 {
-    TmModule *t;
-    uint16_t i;
-
-    for (i = 0; i < TMM_SIZE; i++) {
-        t = &tmm_modules[i];
+    for (uint16_t i = 0; i < TMM_SIZE; i++) {
+        TmModule *t = &tmm_modules[i];
 
         if (t->name == NULL)
             continue;
@@ -155,11 +135,8 @@ void TmModuleRunDeInit(void)
 void TmModuleRegisterTests(void)
 {
 #ifdef UNITTESTS
-    TmModule *t;
-    uint16_t i;
-
-    for (i = 0; i < TMM_SIZE; i++) {
-        t = &tmm_modules[i];
+    for (uint16_t i = 0; i < TMM_SIZE; i++) {
+        TmModule *t = &tmm_modules[i];
 
         if (t->name == NULL)
             continue;