X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fipvs.c;h=e614b935c542b4333bb450c586a01f8eb99c59df;hb=6026e3162e522b133d10596710527d24c2921b55;hp=3b96332e5f4dcea0452f1c76ab77afcdea785040;hpb=79963d13c1884d1d92667cc502ad20758b084a12;p=collectd.git diff --git a/src/ipvs.c b/src/ipvs.c index 3b96332e..e614b935 100644 --- a/src/ipvs.c +++ b/src/ipvs.c @@ -220,15 +220,11 @@ static int get_ti(struct ip_vs_dest_entry *de, char *ti, size_t size) { static void cipvs_submit_connections(const char *pi, const char *ti, derive_t value) { - value_t values[1]; value_list_t vl = VALUE_LIST_INIT; - values[0].derive = value; - - vl.values = values; + vl.values = &(value_t){.derive = value}; vl.values_len = 1; - sstrncpy(vl.host, hostname_g, sizeof(vl.host)); sstrncpy(vl.plugin, "ipvs", sizeof(vl.plugin)); sstrncpy(vl.plugin_instance, pi, sizeof(vl.plugin_instance)); sstrncpy(vl.type, "connections", sizeof(vl.type)); @@ -241,16 +237,14 @@ static void cipvs_submit_connections(const char *pi, const char *ti, static void cipvs_submit_if(const char *pi, const char *t, const char *ti, derive_t rx, derive_t tx) { - value_t values[2]; + value_t values[] = { + {.derive = rx}, {.derive = tx}, + }; value_list_t vl = VALUE_LIST_INIT; - values[0].derive = rx; - values[1].derive = tx; - vl.values = values; - vl.values_len = 2; + vl.values_len = STATIC_ARRAY_SIZE(values); - sstrncpy(vl.host, hostname_g, sizeof(vl.host)); sstrncpy(vl.plugin, "ipvs", sizeof(vl.plugin)); sstrncpy(vl.plugin_instance, pi, sizeof(vl.plugin_instance)); sstrncpy(vl.type, t, sizeof(vl.type)); @@ -301,7 +295,7 @@ static int cipvs_read(void) { struct ip_vs_get_services *services = NULL; if (sockfd < 0) - return (-1); + return -1; if (NULL == (services = ipvs_get_services())) return -1; @@ -327,5 +321,3 @@ void module_register(void) { plugin_register_shutdown("ipvs", cipvs_shutdown); return; } /* module_register */ - -/* vim: set sw=4 ts=4 tw=78 noexpandtab : */