[gnome-desktop-testing/wip/jtojnar/garbage] n_passed is garbage in --list mode



commit 888a1e2efa147d8848ffe487fade867c52998e91
Author: Jan Tojnar <jtojnar gmail com>
Date:   Mon Feb 10 10:21:18 2020 +0100

    n_passed is garbage in --list mode
    
    Detected by clang's scan-build:
    
            src/gnome-desktop-testing-runner.c:1052:16: warning: The left operand of '>' is a garbage value
              if (n_failed > 0)
                  ~~~~~~~~ ^

 src/gnome-desktop-testing-runner.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/src/gnome-desktop-testing-runner.c b/src/gnome-desktop-testing-runner.c
index 7ddaaaf..91e57d8 100644
--- a/src/gnome-desktop-testing-runner.c
+++ b/src/gnome-desktop-testing-runner.c
@@ -851,7 +851,9 @@ main (int argc, char **argv)
   GOptionContext *context;
   TestRunnerApp appstruct;
   const char *const *datadirs_iter;
-  int n_passed, n_skipped, n_failed;
+  int n_passed = 0;
+  int n_skipped = 0;
+  int n_failed = 0;
 
   memset (&appstruct, 0, sizeof (appstruct));
   app = &appstruct;
@@ -1007,7 +1009,6 @@ main (int argc, char **argv)
       struct rusage child_rusage;
       g_autofree char *rusage_str = NULL;
 
-      n_passed = n_skipped = n_failed = 0;
       for (i = 0; i < app->tests->len; i++)
         {
           GdtrTest *test = app->tests->pdata[i];


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