X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fmadwifi.c;h=99e4224370a52d7e1e6d091027bae5f66b2cfe92;hb=80294418289129eb75c9f07e2043adcbd02941a4;hp=406c1c7349db919c8b5257faf94b873c8e336701;hpb=2079ee1517e34de372f58e7e2267ad5c71a8a41f;p=collectd.git diff --git a/src/madwifi.c b/src/madwifi.c index 406c1c73..99e42243 100644 --- a/src/madwifi.c +++ b/src/madwifi.c @@ -509,12 +509,11 @@ static int madwifi_config(const char *key, const char *value) { } static void submit(const char *dev, const char *type, const char *ti1, - const char *ti2, value_t *val, int len) { + const char *ti2, value_t *val, size_t len) { value_list_t vl = VALUE_LIST_INIT; vl.values = val; vl.values_len = len; - sstrncpy(vl.host, hostname_g, sizeof(vl.host)); sstrncpy(vl.plugin, "madwifi", sizeof(vl.plugin)); sstrncpy(vl.plugin_instance, dev, sizeof(vl.plugin_instance)); sstrncpy(vl.type, type, sizeof(vl.type)); @@ -528,25 +527,22 @@ static void submit(const char *dev, const char *type, const char *ti1, } static void submit_derive(const char *dev, const char *type, const char *ti1, - const char *ti2, derive_t val) { - value_t item; - item.derive = val; - submit(dev, type, ti1, ti2, &item, 1); + const char *ti2, derive_t value) { + submit(dev, type, ti1, ti2, &(value_t){.derive = value}, 1); } static void submit_derive2(const char *dev, const char *type, const char *ti1, const char *ti2, derive_t val1, derive_t val2) { - value_t items[2]; - items[0].derive = val1; - items[1].derive = val2; - submit(dev, type, ti1, ti2, items, 2); + value_t values[] = { + {.derive = val1}, {.derive = val2}, + }; + + submit(dev, type, ti1, ti2, values, STATIC_ARRAY_SIZE(values)); } static void submit_gauge(const char *dev, const char *type, const char *ti1, - const char *ti2, gauge_t val) { - value_t item; - item.gauge = val; - submit(dev, type, ti1, ti2, &item, 1); + const char *ti2, gauge_t value) { + submit(dev, type, ti1, ti2, &(value_t){.gauge = value}, 1); } static void submit_antx(const char *dev, const char *name, u_int32_t *vals,