X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fhddtemp.c;h=31960b54e9166b2d3be9eb20f82888668ceb90c0;hb=10139cda6f68ae1f921d79c930dd85944afb74a3;hp=e7b4d8a10d63aefcc153bb9757ca770ec2e1504d;hpb=71bbf854d3e6f8c6d6c3582527263bb01a3a7e04;p=collectd.git diff --git a/src/hddtemp.c b/src/hddtemp.c index e7b4d8a1..31960b54 100644 --- a/src/hddtemp.c +++ b/src/hddtemp.c @@ -30,9 +30,9 @@ **/ #include "collectd.h" + #include "common.h" #include "plugin.h" -#include "configfile.h" # include # include @@ -88,7 +88,7 @@ static int hddtemp_query_daemon (char *buffer, int buffer_size) const char *host; const char *port; - struct addrinfo *ai_list, *ai_ptr; + struct addrinfo *ai_list; int ai_return; host = hddtemp_host; @@ -118,7 +118,7 @@ static int hddtemp_query_daemon (char *buffer, int buffer_size) } fd = -1; - for (ai_ptr = ai_list; ai_ptr != NULL; ai_ptr = ai_ptr->ai_next) + for (struct addrinfo *ai_ptr = ai_list; ai_ptr != NULL; ai_ptr = ai_ptr->ai_next) { /* create our socket descriptor */ fd = socket (ai_ptr->ai_family, ai_ptr->ai_socktype, @@ -226,12 +226,9 @@ static int hddtemp_config (const char *key, const char *value) static void hddtemp_submit (char *type_instance, double value) { - value_t values[1]; value_list_t vl = VALUE_LIST_INIT; - values[0].gauge = value; - - vl.values = values; + vl.values = &(value_t) { .gauge = value }; vl.values_len = 1; sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "hddtemp", sizeof (vl.plugin)); @@ -249,7 +246,6 @@ static int hddtemp_read (void) char *saveptr; int num_fields; int num_disks; - int i; /* get data from daemon */ if (hddtemp_query_daemon (buf, sizeof (buf)) < 0) @@ -270,7 +266,7 @@ static int hddtemp_read (void) num_disks = num_fields / 4; - for (i = 0; i < num_disks; i++) + for (int i = 0; i < num_disks; i++) { char *name; double temperature;