X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fipvs.c;h=6bd868eb5b75c4700d68513c8c6088fa52b49c4b;hb=a4b9c9ad2d77656892026ad4b51f9fb7c2a58149;hp=92690e88e0098635a8cc56fe9c6191116b81082e;hpb=2761915bed8c6caea41018be3e675aa712cc0b0a;p=collectd.git diff --git a/src/ipvs.c b/src/ipvs.c index 92690e88..6bd868eb 100644 --- a/src/ipvs.c +++ b/src/ipvs.c @@ -228,15 +228,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)); @@ -250,16 +246,15 @@ 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));