X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fchrony.c;h=6fb369a2f167b043618318b98c88764902fd5540;hb=a0412f28fc15eb04a9a630678a97b6bce2d71fb1;hp=988fc3baafc390b98ed03f61fb08aa0a00bb7018;hpb=5126b0422a63de838cf6fb7cf0e7dcd9bcc658e7;p=collectd.git diff --git a/src/chrony.c b/src/chrony.c index 988fc3ba..6fb369a2 100644 --- a/src/chrony.c +++ b/src/chrony.c @@ -348,10 +348,10 @@ static char *niptoha(const tChrony_IPAddr *addr, char *p_buf, } static void nreftostr(uint32_t nrefid, char *p_buf, size_t p_buf_size) { - int i, j, c; + size_t j = 0; - for (i = j = 0; i < 4; i++) { - c = ntohl(nrefid) << i * 8 >> 24; + for (int i = 0; i < 4; i++) { + int c = ntohl(nrefid) << i * 8 >> 24; if (!isalnum(c) || j + 1 >= p_buf_size) continue; p_buf[j++] = c; @@ -892,8 +892,9 @@ static int chrony_request_source_data(int p_src_idx, char *src_addr, ntohs(chrony_resp.body.source_data.f_reachability)); chrony_push_data_valid("clock_last_meas", src_addr, is_reachable, ntohl(chrony_resp.body.source_data.f_since_sample)); - chrony_push_data_valid("time_offset", src_addr, is_reachable, - ntohf(chrony_resp.body.source_data.f_origin_latest_meas)); + chrony_push_data_valid( + "time_offset", src_addr, is_reachable, + ntohf(chrony_resp.body.source_data.f_origin_latest_meas)); return CHRONY_RC_OK; }