projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'collectd-5.6'
[collectd.git]
/
src
/
ntpd.c
diff --git
a/src/ntpd.c
b/src/ntpd.c
index
02c9f6d
..
7f6f982
100644
(file)
--- a/
src/ntpd.c
+++ b/
src/ntpd.c
@@
-31,7
+31,6
@@
#include "common.h"
#include "plugin.h"
#include "common.h"
#include "plugin.h"
-#include "configfile.h"
#if HAVE_STDINT_H
# include <stdint.h>
#if HAVE_STDINT_H
# include <stdint.h>
@@
-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)
{
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;
value_list_t vl = VALUE_LIST_INIT;
- values[0].gauge = value;
-
- vl.values = values;
+ vl.values = &(value_t) { .gauge = value };
vl.values_len = 1;
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "ntpd", sizeof (vl.plugin));
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));
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;
const char *port;
struct addrinfo *ai_list;
- struct addrinfo *ai_ptr;
int status;
if (sock_descr >= 0)
int status;
if (sock_descr >= 0)
@@
-382,7
+375,7
@@
static int ntpd_connect (void)
return (-1);
}
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,
{
/* 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;
struct resp_pkt res;
int status;
int done;
- int i;
char *items;
size_t items_num;
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;
items_num += pkt_item_num;
*res_data = items;
- for (i = 0; i < pkt_item_num; i++)
+ for (i
nt 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
{
/* 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;
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. */
/* 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);
}
return (-1);
}
- for (i = 0; i < ps_num; i++)
+ for (i
nt i
= 0; i < ps_num; i++)
{
struct info_peer_summary *ptr;
double offset;
{
struct info_peer_summary *ptr;
double offset;