From d545b4d860cb82a77541018a6e211d00c8ae19d0 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Tue, 11 Feb 2025 19:32:40 +0100 Subject: [PATCH] threads: fix int as pointer warning for pthread_exit clang-tidy: warning: integer to pointer cast pessimizes optimization opportunities Since the returned code of -1 was never read, just return NULL. --- src/tm-threads.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/tm-threads.c b/src/tm-threads.c index 5da183c311..b8ba6cde04 100644 --- a/src/tm-threads.c +++ b/src/tm-threads.c @@ -251,7 +251,7 @@ static void *TmThreadsSlotPktAcqLoop(void *td) " tmqh_out=%p", s, s ? s->PktAcqLoop : NULL, tv->tmqh_in, tv->tmqh_out); TmThreadsSetFlag(tv, THV_CLOSED | THV_RUNNING_DONE); - pthread_exit((void *) -1); + pthread_exit(NULL); return NULL; } @@ -280,7 +280,7 @@ static void *TmThreadsSlotPktAcqLoop(void *td) tv->flow_queue = FlowQueueNew(); if (tv->flow_queue == NULL) { TmThreadsSetFlag(tv, THV_CLOSED | THV_RUNNING_DONE); - pthread_exit((void *) -1); + pthread_exit(NULL); return NULL; } /* setup a queue */ @@ -295,7 +295,7 @@ static void *TmThreadsSlotPktAcqLoop(void *td) tv->flow_queue = FlowQueueNew(); if (tv->flow_queue == NULL) { TmThreadsSetFlag(tv, THV_CLOSED | THV_RUNNING_DONE); - pthread_exit((void *) -1); + pthread_exit(NULL); return NULL; } } @@ -354,7 +354,7 @@ static void *TmThreadsSlotPktAcqLoop(void *td) error: tv->stream_pq = NULL; - pthread_exit((void *) -1); + pthread_exit(NULL); return NULL; } @@ -400,7 +400,7 @@ static void *TmThreadsSlotVar(void *td) /* check if we are setup properly */ if (s == NULL || tv->tmqh_in == NULL || tv->tmqh_out == NULL) { TmThreadsSetFlag(tv, THV_CLOSED | THV_RUNNING_DONE); - pthread_exit((void *) -1); + pthread_exit(NULL); return NULL; } @@ -426,7 +426,7 @@ static void *TmThreadsSlotVar(void *td) tv->flow_queue = FlowQueueNew(); if (tv->flow_queue == NULL) { TmThreadsSetFlag(tv, THV_CLOSED | THV_RUNNING_DONE); - pthread_exit((void *) -1); + pthread_exit(NULL); return NULL; } /* setup a queue */ @@ -441,7 +441,7 @@ static void *TmThreadsSlotVar(void *td) tv->flow_queue = FlowQueueNew(); if (tv->flow_queue == NULL) { TmThreadsSetFlag(tv, THV_CLOSED | THV_RUNNING_DONE); - pthread_exit((void *) -1); + pthread_exit(NULL); return NULL; } } @@ -524,7 +524,7 @@ static void *TmThreadsSlotVar(void *td) error: tv->stream_pq = NULL; - pthread_exit((void *) -1); + pthread_exit(NULL); return NULL; } @@ -551,7 +551,7 @@ static void *TmThreadsManagement(void *td) r = s->SlotThreadInit(tv, s->slot_initdata, &slot_data); if (r != TM_ECODE_OK) { TmThreadsSetFlag(tv, THV_CLOSED | THV_RUNNING_DONE); - pthread_exit((void *) -1); + pthread_exit(NULL); return NULL; } (void)SC_ATOMIC_SET(s->slot_data, slot_data); @@ -582,7 +582,7 @@ static void *TmThreadsManagement(void *td) r = s->SlotThreadDeinit(tv, SC_ATOMIC_GET(s->slot_data)); if (r != TM_ECODE_OK) { TmThreadsSetFlag(tv, THV_CLOSED); - pthread_exit((void *) -1); + pthread_exit(NULL); return NULL; } } -- 2.47.2