X-Git-Url: https://git.octo.it/?p=collectd.git;a=blobdiff_plain;f=src%2Fchrony.c;h=6fb369a2f167b043618318b98c88764902fd5540;hp=a5e85a8a84b1a42e2a2eff7384027c397c3c9fb0;hb=1159cb5d383c55a80a0db100b8f7aadcf44740a5;hpb=662c44a84ae3daecd4ffdea940fffce35a41b52a diff --git a/src/chrony.c b/src/chrony.c index a5e85a8a..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;