From 7513f6cae27d1c4ff0c5af0db851e6a302e6f3b4 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Wed, 12 Jun 2019 09:57:02 +0200 Subject: [PATCH] threads: minor code cleanups --- src/tm-threads.c | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/src/tm-threads.c b/src/tm-threads.c index 895d3ed7fa..7e3ea98aaa 100644 --- a/src/tm-threads.c +++ b/src/tm-threads.c @@ -785,14 +785,9 @@ error: ThreadVars *TmThreadsGetTVContainingSlot(TmSlot *tm_slot) { - ThreadVars *tv; - int i; - SCMutexLock(&tv_root_lock); - - for (i = 0; i < TVT_MAX; i++) { - tv = tv_root[i]; - + for (int i = 0; i < TVT_MAX; i++) { + ThreadVars *tv = tv_root[i]; while (tv) { TmSlot *slots = tv->tm_slots; while (slots != NULL) { @@ -805,9 +800,7 @@ ThreadVars *TmThreadsGetTVContainingSlot(TmSlot *tm_slot) tv = tv->next; } } - SCMutexUnlock(&tv_root_lock); - return NULL; } @@ -871,16 +864,11 @@ void TmSlotSetFuncAppend(ThreadVars *tv, TmModule *tm, const void *data) */ TmSlot *TmSlotGetSlotForTM(int tm_id) { - ThreadVars *tv = NULL; - TmSlot *slots; - int i; - SCMutexLock(&tv_root_lock); - - for (i = 0; i < TVT_MAX; i++) { - tv = tv_root[i]; + for (int i = 0; i < TVT_MAX; i++) { + ThreadVars *tv = tv_root[i]; while (tv) { - slots = tv->tm_slots; + TmSlot *slots = tv->tm_slots; while (slots != NULL) { if (slots->tm_id == tm_id) { SCMutexUnlock(&tv_root_lock); @@ -891,9 +879,7 @@ TmSlot *TmSlotGetSlotForTM(int tm_id) tv = tv->next; } } - SCMutexUnlock(&tv_root_lock); - return NULL; }