]> diplodocus.org Git - nmh/blobdiff - sbr/oauth.c
slocal.c: Alter trim() to return static array, not malloc(3).
[nmh] / sbr / oauth.c
index 3aeeccbe407e541c47febf135b79e4a03a33f9bd..ec485cdfac827cc296039bcc252ac54e82c3e898 100755 (executable)
@@ -945,7 +945,7 @@ post(struct curl_ctx *ctx, const char *url, const char *req_body)
         curl_easy_setopt(curl, CURLOPT_DEBUGDATA, ctx->log);
     }
 
-    if ((status = curl_easy_setopt(curl, CURLOPT_URL, url)) != CURLE_OK) {
+    if (curl_easy_setopt(curl, CURLOPT_URL, url) != CURLE_OK) {
         return false;
     }
 
@@ -971,14 +971,10 @@ post(struct curl_ctx *ctx, const char *url, const char *req_body)
         return false;
     }
 
-    if ((status = curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE,
-                                    &ctx->res_code)) != CURLE_OK
-        || (status = 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;
 }
 
 /*