X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fntpd.c;h=4a31e455eece36ad595f8bbc41ac7ee6985c35e7;hb=5c2993e4121feae745551be182221b31bc23ff97;hp=ee2c048ee6ec2eea1d2325daed3dca0bd9445aef;hpb=749b03b3fc459895b7415c7c13753066bf0af55b;p=collectd.git diff --git a/src/ntpd.c b/src/ntpd.c index ee2c048e..4a31e455 100644 --- a/src/ntpd.c +++ b/src/ntpd.c @@ -163,16 +163,16 @@ struct resp_pkt /* l_fp to double */ #define M_LFPTOD(r_i, r_uf, d) \ do { \ - register int32_t i; \ - register uint32_t f; \ + register int32_t ri; \ + register uint32_t rf; \ \ - i = (r_i); \ - f = (r_uf); \ - if (i < 0) { \ - M_NEG(i, f); \ - (d) = -((double) i + ((double) f) / 4294967296.0); \ + ri = (r_i); \ + rf = (r_uf); \ + if (ri < 0) { \ + M_NEG(ri, rf); \ + (d) = -((double) ri + ((double) rf) / 4294967296.0); \ } else { \ - (d) = (double) i + ((double) f) / 4294967296.0; \ + (d) = (double) ri + ((double) rf) / 4294967296.0; \ } \ } while (0) @@ -247,7 +247,7 @@ struct info_kernel }; /* List of reference clock names */ -static char *refclock_names[] = +static const char *refclock_names[] = { "UNKNOWN", "LOCAL", "GPS_TRAK", "WWV_PST", /* 0- 3 */ "SPECTRACOM", "TRUETIME", "IRIG_AUDIO", "CHU_AUDIO", /* 4- 7 */ @@ -307,7 +307,7 @@ static int ntpd_config (const char *key, const char *value) return (0); } -static void ntpd_submit (char *type, 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; @@ -328,8 +328,8 @@ static void ntpd_submit (char *type, char *type_inst, gauge_t value) /* Each time a peer is polled, ntpd shifts the reach register to the left and * sets the LSB based on whether the peer was reachable. If the LSB is zero, * the values are out of date. */ -static void ntpd_submit_reach (char *type, char *type_inst, uint8_t reach, - gauge_t value) +static void ntpd_submit_reach (const char *type, const char *type_inst, + uint8_t reach, gauge_t value) { if (!(reach & 1)) value = NAN; @@ -339,8 +339,8 @@ static void ntpd_submit_reach (char *type, char *type_inst, uint8_t reach, static int ntpd_connect (void) { - char *host; - char *port; + const char *host; + const char *port; struct addrinfo ai_hints; struct addrinfo *ai_list;