X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fswap.c;h=cbe1ab11077957a6621627195ee7c55647211332;hb=7173100796caa3ce86d373245767e3d185d09817;hp=f64a9b3999b31702afefb2fba7967a0fb15d200e;hpb=2079ee1517e34de372f58e7e2267ad5c71a8a41f;p=collectd.git diff --git a/src/swap.c b/src/swap.c index f64a9b39..cbe1ab11 100644 --- a/src/swap.c +++ b/src/swap.c @@ -190,12 +190,10 @@ static int swap_init(void) /* {{{ */ static void swap_submit_usage(char const *plugin_instance, /* {{{ */ gauge_t used, gauge_t free, char const *other_name, gauge_t other_value) { - value_t v[1]; value_list_t vl = VALUE_LIST_INIT; - vl.values = v; - vl.values_len = STATIC_ARRAY_SIZE(v); - sstrncpy(vl.host, hostname_g, sizeof(vl.host)); + vl.values = &(value_t){.gauge = NAN}; + vl.values_len = 1; sstrncpy(vl.plugin, "swap", sizeof(vl.plugin)); if (plugin_instance != NULL) sstrncpy(vl.plugin_instance, plugin_instance, sizeof(vl.plugin_instance)); @@ -214,13 +212,9 @@ __attribute__((nonnull(1))) static void swap_submit_derive(char const *type_instance, /* {{{ */ derive_t value) { value_list_t vl = VALUE_LIST_INIT; - value_t v[1]; - v[0].derive = value; - - vl.values = v; - vl.values_len = STATIC_ARRAY_SIZE(v); - sstrncpy(vl.host, hostname_g, sizeof(vl.host)); + vl.values = &(value_t){.derive = value}; + vl.values_len = 1; sstrncpy(vl.plugin, "swap", sizeof(vl.plugin)); sstrncpy(vl.type, "swap_io", sizeof(vl.type)); sstrncpy(vl.type_instance, type_instance, sizeof(vl.type_instance));