]> granicus.if.org Git - check/commitdiff
Removing some useless else
authorNicola Spanti (RyDroid) <dev@nicola-spanti.info>
Mon, 6 Mar 2017 22:12:59 +0000 (23:12 +0100)
committerNicola Spanti (RyDroid) <dev@nicola-spanti.info>
Mon, 6 Mar 2017 22:12:59 +0000 (23:12 +0100)
src/check_list.c
src/check_run.c
src/check_str.c

index 2775e25eb2bf2def9987aa8d0509abd7ec8a8d3e..00c71517c857ccf3b9087c8a9e8aa43911007927 100644 (file)
@@ -90,8 +90,7 @@ int check_list_at_end(List * lp)
 {
     if(lp->current == -1)
         return 1;
-    else
-        return (lp->current > lp->last);
+    return (lp->current > lp->last);
 }
 
 void check_list_front(List * lp)
index 9539f80da138366734a3955ad971e210724e8e90..da1f40f147a3d5610fe849cb772b6306fbcf4324 100644 (file)
@@ -735,18 +735,14 @@ enum fork_status srunner_fork_status(SRunner * sr)
 #endif
         if(strcmp(env, "no") == 0)
             return CK_NOFORK;
-        else
-        {
 #if defined(HAVE_FORK) && HAVE_FORK==1
-            return CK_FORK;
+        return CK_FORK;
 #else /* HAVE_FORK */
-            /* Ignoring, as Check is not compiled with fork support. */
-            return CK_NOFORK;
+        /* Ignoring, as Check is not compiled with fork support. */
+        return CK_NOFORK;
 #endif /* HAVE_FORK */
-        }
     }
-    else
-        return sr->fstat;
+    return sr->fstat;
 }
 
 void srunner_set_fork_status(SRunner * sr, enum fork_status fstat)
index 58fdc11dc1c152870a1ba04b21b090897c356947..2ae093fdfbbda7beaf26fa69a3e7046e64967199 100644 (file)
@@ -106,30 +106,25 @@ char *ck_strdup_printf(const char *fmt, ...)
 
 static const char *tr_type_str(TestResult * tr)
 {
-    const char *str = NULL;
-
     if(tr->ctx == CK_CTX_TEST)
     {
         if(tr->rtype == CK_PASS)
-            str = "P";
-        else if(tr->rtype == CK_FAILURE)
-            str = "F";
-        else if(tr->rtype == CK_ERROR)
-            str = "E";
+            return "P";
+        if(tr->rtype == CK_FAILURE)
+            return "F";
+        if(tr->rtype == CK_ERROR)
+            return "E";
+        return NULL;
     }
-    else
-        str = "S";
-
-    return str;
+    return "S";
 }
 
 static int percent_passed(TestStats * t)
 {
     if(t->n_failed == 0 && t->n_errors == 0)
         return 100;
-    else if(t->n_checked == 0)
+    if(t->n_checked == 0)
         return 0;
-    else
-        return (int)((float)(t->n_checked - (t->n_failed + t->n_errors)) /
-                     (float)t->n_checked * 100);
+    return (int)((float)(t->n_checked - (t->n_failed + t->n_errors)) /
+                 (float)t->n_checked * 100);
 }