From: Miroslav Lichvar Date: Tue, 20 Mar 2018 09:16:39 +0000 (+0100) Subject: ntp: fix compiler warnings X-Git-Tag: 3.3~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=02de782fa36da189df9a9f654bffa77a4d6fa1e2;p=thirdparty%2Fchrony.git ntp: fix compiler warnings Warnings about using uninitialized variables were seen with gcc-7.3.1 and -O3 in CFLAGS. --- diff --git a/ntp_sources.c b/ntp_sources.c index ff0be6e5..e7fb60fd 100644 --- a/ntp_sources.c +++ b/ntp_sources.c @@ -206,12 +206,13 @@ find_slot(NTP_Remote_Address *remote_addr, int *slot, int *found) unsigned short port; size = ARR_GetSize(records); + + *slot = 0; + *found = 0; if (remote_addr->ip_addr.family != IPADDR_INET4 && - remote_addr->ip_addr.family != IPADDR_INET6) { - *found = *slot = 0; + remote_addr->ip_addr.family != IPADDR_INET6) return; - } hash = UTI_IPToHash(&remote_addr->ip_addr); port = remote_addr->port; @@ -230,8 +231,6 @@ find_slot(NTP_Remote_Address *remote_addr, int *slot, int *found) return; } } - - *found = 0; } /* ================================================== */