From: Nicola Spanti (RyDroid) Date: Mon, 6 Mar 2017 22:12:59 +0000 (+0100) Subject: Removing some useless else X-Git-Tag: 0.12.0~10^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=15edc018237a87929fea82ae33620554825088d1;p=check Removing some useless else --- diff --git a/src/check_list.c b/src/check_list.c index 2775e25..00c7151 100644 --- a/src/check_list.c +++ b/src/check_list.c @@ -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) diff --git a/src/check_run.c b/src/check_run.c index 9539f80..da1f40f 100644 --- a/src/check_run.c +++ b/src/check_run.c @@ -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) diff --git a/src/check_str.c b/src/check_str.c index 58fdc11..2ae093f 100644 --- a/src/check_str.c +++ b/src/check_str.c @@ -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); }