tm-modules: minor code cleanups

- includes
- loops
pull/11880/head
Jason Ish 2 years ago
parent 415c5786de
commit d8f73c9215

@ -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
@ -23,22 +23,15 @@
* 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;

Loading…
Cancel
Save