X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fcurl_json.c;h=09a606a8b18b7ebd62a6d8a409929b1964f4bd01;hb=46fdf1fbedc20bff90fc85555e0afba193ab0a31;hp=07d575e54af1c3fe49a20fc92db9a95c7df172ac;hpb=641c1c3ce02a2bfe45590ef2b4cdf4f2f68472a1;p=collectd.git diff --git a/src/curl_json.c b/src/curl_json.c index 07d575e5..09a606a8 100644 --- a/src/curl_json.c +++ b/src/curl_json.c @@ -288,11 +288,10 @@ static int cj_cb_string(void *ctx, const unsigned char *val, yajl_len_t len) { } /* int cj_cb_string */ static int cj_cb_boolean(void *ctx, int boolVal) { - if (boolVal) { - return (cj_cb_number (ctx, "1", 1)); - } else { - return (cj_cb_number (ctx, "0", 1)); - } + if (boolVal) + return cj_cb_number(ctx, "1", 1); + else + return cj_cb_number(ctx, "0", 1); } /* int cj_cb_boolean */ static int cj_cb_end(void *ctx) { @@ -825,7 +824,6 @@ static void cj_submit_impl(cj_t *db, cj_key_t *key, value_t *value) /* {{{ */ static int cj_sock_perform(cj_t *db) /* {{{ */ { - char errbuf[1024]; struct sockaddr_un sa_unix = { .sun_family = AF_UNIX, }; @@ -836,8 +834,7 @@ static int cj_sock_perform(cj_t *db) /* {{{ */ return -1; if (connect(fd, (struct sockaddr *)&sa_unix, sizeof(sa_unix)) < 0) { ERROR("curl_json plugin: connect(%s) failed: %s", - (db->sock != NULL) ? db->sock : "", - sstrerror(errno, errbuf, sizeof(errbuf))); + (db->sock != NULL) ? db->sock : "", STRERRNO); close(fd); return -1; } @@ -848,8 +845,7 @@ static int cj_sock_perform(cj_t *db) /* {{{ */ red = read(fd, buffer, sizeof(buffer)); if (red < 0) { ERROR("curl_json plugin: read(%s) failed: %s", - (db->sock != NULL) ? db->sock : "", - sstrerror(errno, errbuf, sizeof(errbuf))); + (db->sock != NULL) ? db->sock : "", STRERRNO); close(fd); return -1; }