From: Jim Radford Date: Thu, 8 Aug 2013 16:33:36 +0000 (-0700) Subject: curl_json plugin: style cleanups X-Git-Tag: collectd-5.4.0~3^2~2^2~3 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=a6024883c9737881283159bcaf034199eec6a4e6;p=collectd.git curl_json plugin: style cleanups --- diff --git a/src/curl_json.c b/src/curl_json.c index 253ca27d..87907c03 100644 --- a/src/curl_json.c +++ b/src/curl_json.c @@ -266,7 +266,8 @@ static int cj_cb_start (void *ctx) cj_t *db = (cj_t *)ctx; if (++db->depth >= YAJL_MAX_DEPTH) { - ERROR ("curl_json plugin: %s depth exceeds max, aborting.", db->url ? db->url : db->sock); + ERROR ("curl_json plugin: %s depth exceeds max, aborting.", + db->url ? db->url : db->sock); return (CJ_CB_ABORT); } return (CJ_CB_CONTINUE); @@ -658,8 +659,8 @@ static int cj_config_add_url (oconfig_item_t *ci) /* {{{ */ { if (db->tree == NULL) { - WARNING ("curl_json plugin: No (valid) `Key' block " - "within `%s' block `%s'.", db->url ? "URL" : "Sock", db->url ? db->url : db->sock); + WARNING ("curl_json plugin: No (valid) `Key' block within `%s' \"`%s'\".", + db->url ? "URL" : "Sock", db->url ? db->url : db->sock); status = -1; } if (status == 0 && db->url) @@ -712,7 +713,8 @@ static int cj_config (oconfig_item_t *ci) /* {{{ */ { oconfig_item_t *child = ci->children + i; - if (strcasecmp ("Sock", child->key) == 0 || strcasecmp ("URL", child->key) == 0) + if (strcasecmp ("Sock", child->key) == 0 + || strcasecmp ("URL", child->key) == 0) { status = cj_config_add_url (child); if (status == 0) @@ -857,7 +859,11 @@ static int cj_perform (cj_t *db) /* {{{ */ return (-1); } - if (db->url ? cj_curl_perform (db) < 0 : cj_sock_perform (db) < 0) + if (db->url) + status = cj_curl_perform (db); + else + status = cj_sock_perform (db); + if (status < 0) { yajl_free (db->yajl); db->yajl = yprev;