X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fzookeeper.c;h=539112e85d1e7120f7aa8be7585f53f9887100f3;hb=c53c496b6db4e11fd8aed8df9556dad481220196;hp=a3b73628bdc44d76db44f73a91d475c97fbb552d;hpb=aa3811995bfae69f0d1a0f897acfa4a9a4c0138a;p=collectd.git diff --git a/src/zookeeper.c b/src/zookeeper.c index a3b73628..539112e8 100644 --- a/src/zookeeper.c +++ b/src/zookeeper.c @@ -25,6 +25,7 @@ **/ #include "collectd.h" + #include "common.h" #include "plugin.h" @@ -65,16 +66,12 @@ static int zookeeper_config(const char *key, const char *value) return 0; } -static void zookeeper_submit_gauge (const char * type, const char * type_inst, gauge_t val) +static void zookeeper_submit_gauge (const char * type, const char * type_inst, gauge_t value) { - value_t values[1]; value_list_t vl = VALUE_LIST_INIT; - values[0].gauge = val; - - vl.values = values; + vl.values = &(value_t) { .gauge = value }; vl.values_len = 1; - sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "zookeeper", sizeof (vl.plugin)); sstrncpy (vl.type, type, sizeof (vl.type)); if (type_inst != NULL) @@ -83,16 +80,12 @@ static void zookeeper_submit_gauge (const char * type, const char * type_inst, g plugin_dispatch_values (&vl); } /* zookeeper_submit_gauge */ -static void zookeeper_submit_derive (const char * type, const char * type_inst, derive_t val) +static void zookeeper_submit_derive (const char * type, const char * type_inst, derive_t value) { - value_t values[1]; value_list_t vl = VALUE_LIST_INIT; - values[0].derive = val; - - vl.values = values; + vl.values = &(value_t) { .derive = value }; vl.values_len = 1; - sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "zookeeper", sizeof (vl.plugin)); sstrncpy (vl.type, type, sizeof (vl.type)); if (type_inst != NULL) @@ -105,7 +98,6 @@ static int zookeeper_connect (void) { int sk = -1; int status; - struct addrinfo *ai; struct addrinfo *ai_list; const char *host; const char *port; @@ -129,7 +121,7 @@ static int zookeeper_connect (void) return (-1); } - for (ai = ai_list; ai != NULL; ai = ai->ai_next) + for (struct addrinfo *ai = ai_list; ai != NULL; ai = ai->ai_next) { sk = socket (ai->ai_family, SOCK_STREAM, 0); if (sk < 0)