From: Victor Julien Date: Tue, 11 Feb 2025 18:32:40 +0000 (+0100) Subject: threads: fix int as pointer warning for pthread_exit X-Git-Tag: suricata-8.0.0-beta1~452 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F12565%2Fhead;p=thirdparty%2Fsuricata.git 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. --- 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; } }