]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
threads: fix int as pointer warning for pthread_exit 12565/head
authorVictor Julien <vjulien@oisf.net>
Tue, 11 Feb 2025 18:32:40 +0000 (19:32 +0100)
committerVictor Julien <vjulien@oisf.net>
Wed, 12 Feb 2025 08:11:19 +0000 (09:11 +0100)
 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

index 5da183c311bebb9d5b7c80446368b0e29e7e0cef..b8ba6cde04e958831037e4b6452004c0eb69e543 100644 (file)
@@ -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;
         }
     }