From: Ralph Corderoy Date: Mon, 4 Sep 2017 09:42:17 +0000 (+0100) Subject: oauth: Replace `if...return false; return true' with `return ...'. X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/89c8afe012920fe9592a510a8beab877bed1656b?ds=sidebyside oauth: Replace `if...return false; return true' with `return ...'. In functions returning bool, these are equivalent. Before: After: if (!foo()) return foo(); return false; return true; --- diff --git a/sbr/oauth.c b/sbr/oauth.c index e91e0bb4..ec485cdf 100755 --- a/sbr/oauth.c +++ b/sbr/oauth.c @@ -971,14 +971,10 @@ post(struct curl_ctx *ctx, const char *url, const char *req_body) return false; } - if (curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, - &ctx->res_code) != CURLE_OK - || curl_easy_getinfo(curl, CURLINFO_CONTENT_TYPE, - &ctx->content_type) != CURLE_OK) { - return false; - } - - return true; + return curl_easy_getinfo(curl, + CURLINFO_RESPONSE_CODE, &ctx->res_code) == CURLE_OK && + curl_easy_getinfo(curl, + CURLINFO_CONTENT_TYPE, &ctx->content_type) == CURLE_OK; } /******************************************************************************* @@ -1019,11 +1015,8 @@ parse_json(jsmntok_t **tokens, size_t *tokens_len, of the response body. */ *tokens = mh_xrealloc(*tokens, *tokens_len * sizeof **tokens); } - if (r <= 0) { - return false; - } - return true; + return r > 0; } /* diff --git a/sbr/oauth_prof.c b/sbr/oauth_prof.c index 26132fa2..b5416380 100644 --- a/sbr/oauth_prof.c +++ b/sbr/oauth_prof.c @@ -124,11 +124,7 @@ mh_oauth_get_service_info(const char *svc_name, mh_oauth_service_info *svcinfo, } } - if (!update_svc(svcinfo, svc_name, errbuf, errbuflen)) { - return false; - } - - return true; + return update_svc(svcinfo, svc_name, errbuf, errbuflen); } const char *