X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fdns.c;h=ae53710b24783dbf5193eacd242833e07e6414af;hb=1aa4295ba6875ceb02a7383237bc2485ffab9c1e;hp=53128396232b848c34645010dcbc64d36eac1281;hpb=448627953cde2f7b3b138f53f4f2c62f0d48b726;p=collectd.git diff --git a/src/dns.c b/src/dns.c index 53128396..ae53710b 100644 --- a/src/dns.c +++ b/src/dns.c @@ -28,7 +28,6 @@ #include "common.h" #include "plugin.h" -#include "configfile.h" #include "utils_dns.h" #include @@ -357,7 +356,7 @@ static int dns_init (void) if (getuid () == 0) WARNING ("dns plugin: Running collectd as root, but the CAP_NET_RAW " "capability is missing. The plugin's read function will probably " - "fail. Is your init system dropping capabilities ?"); + "fail. Is your init system dropping capabilities?"); else WARNING ("dns plugin: collectd doesn't have the CAP_NET_RAW capability. " "If you don't want to run collectd as root, try running \"setcap " @@ -371,12 +370,9 @@ static int dns_init (void) static void submit_derive (const char *type, const char *type_instance, 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, "dns", sizeof (vl.plugin)); @@ -388,14 +384,14 @@ static void submit_derive (const char *type, const char *type_instance, static void submit_octets (derive_t queries, derive_t responses) { - value_t values[2]; + value_t values[] = { + { .derive = queries }, + { .derive = responses }, + }; value_list_t vl = VALUE_LIST_INIT; - values[0].derive = queries; - values[1].derive = responses; - 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, "dns", sizeof (vl.plugin)); sstrncpy (vl.type, "dns_octets", sizeof (vl.type));