X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fntpd.c;h=7f6f982aac824cc3ef63255bf01b809c3226ea70;hb=0a8741b9061f8df4a78a448c021612db06e17425;hp=02c9f6dc9566cc7e11d0fe1302849a76013ec894;hpb=063a5e75b36173e89ffa18d32d47509f6ef968ec;p=collectd.git diff --git a/src/ntpd.c b/src/ntpd.c index 02c9f6dc..7f6f982a 100644 --- a/src/ntpd.c +++ b/src/ntpd.c @@ -31,7 +31,6 @@ #include "common.h" #include "plugin.h" -#include "configfile.h" #if HAVE_STDINT_H # include @@ -314,16 +313,11 @@ static int ntpd_config (const char *key, const char *value) static void ntpd_submit (const char *type, const char *type_inst, gauge_t 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, "ntpd", sizeof (vl.plugin)); - sstrncpy (vl.plugin_instance, "", sizeof (vl.plugin_instance)); sstrncpy (vl.type, type, sizeof (vl.type)); sstrncpy (vl.type_instance, type_inst, sizeof (vl.type_instance)); @@ -348,7 +342,6 @@ static int ntpd_connect (void) const char *port; struct addrinfo *ai_list; - struct addrinfo *ai_ptr; int status; if (sock_descr >= 0) @@ -382,7 +375,7 @@ static int ntpd_connect (void) return (-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 */ if ((sock_descr = socket (ai_ptr->ai_family, @@ -420,7 +413,6 @@ static int ntpd_receive_response (int *res_items, int *res_size, struct resp_pkt res; int status; int done; - int i; char *items; size_t items_num; @@ -674,7 +666,7 @@ static int ntpd_receive_response (int *res_items, int *res_size, items_num += pkt_item_num; *res_data = items; - for (i = 0; i < pkt_item_num; i++) + for (int i = 0; i < pkt_item_num; i++) { /* dst: There are already `*res_items' items with * res_item_size bytes each in in `*res_data'. Set @@ -903,7 +895,6 @@ static int ntpd_read (void) gauge_t offset_error; int status; - int i; /* On Linux, if the STA_NANO bit is set in ik->status, then ik->offset * is is nanoseconds, otherwise it's microseconds. */ @@ -971,7 +962,7 @@ static int ntpd_read (void) return (-1); } - for (i = 0; i < ps_num; i++) + for (int i = 0; i < ps_num; i++) { struct info_peer_summary *ptr; double offset;