[glib: 7/9] tests: Remove some redundant writes




commit b509e59726e5069b5ea1b0bc586b6f1824b55482
Author: Philip Withnall <pwithnall endlessos org>
Date:   Thu Apr 28 11:18:34 2022 +0100

    tests: Remove some redundant writes
    
    `ret` was never read. This fixes scan-build warnings:
    ```
    ../../../../source/glib/glib/tests/thread.c:148:8: warning: Although the value stored to 'ret' is used in 
the enclosing expression, the value is never actually read from 'ret' [deadcode.DeadStores]
      if ((ret = prlimit (getpid (), RLIMIT_NPROC, &nl, &ol)) != 0)
           ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ../../../../source/glib/glib/tests/thread.c:174:8: warning: Although the value stored to 'ret' is used in 
the enclosing expression, the value is never actually read from 'ret' [deadcode.DeadStores]
      if ((ret = prlimit (getpid (), RLIMIT_NPROC, &ol, NULL)) != 0)
           ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ```
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>
    
    Helps: #1767

 glib/tests/thread.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
---
diff --git a/glib/tests/thread.c b/glib/tests/thread.c
index 2bae96c582..14f571076f 100644
--- a/glib/tests/thread.c
+++ b/glib/tests/thread.c
@@ -140,12 +140,11 @@ test_thread4 (void)
   struct rlimit ol, nl;
   GThread *thread;
   GError *error;
-  gint ret;
 
   getrlimit (RLIMIT_NPROC, &nl);
   nl.rlim_cur = 1;
 
-  if ((ret = prlimit (getpid (), RLIMIT_NPROC, &nl, &ol)) != 0)
+  if (prlimit (getpid (), RLIMIT_NPROC, &nl, &ol) != 0)
     g_error ("prlimit failed: %s", g_strerror (errno));
 
   error = NULL;
@@ -171,7 +170,7 @@ test_thread4 (void)
       g_error_free (error);
     }
 
-  if ((ret = prlimit (getpid (), RLIMIT_NPROC, &ol, NULL)) != 0)
+  if (prlimit (getpid (), RLIMIT_NPROC, &ol, NULL) != 0)
     g_error ("resetting RLIMIT_NPROC failed: %s", g_strerror (errno));
 #endif
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]