]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
ntp: fix compiler warnings
authorMiroslav Lichvar <mlichvar@redhat.com>
Tue, 20 Mar 2018 09:16:39 +0000 (10:16 +0100)
committerMiroslav Lichvar <mlichvar@redhat.com>
Wed, 28 Mar 2018 14:57:48 +0000 (16:57 +0200)
Warnings about using uninitialized variables were seen with gcc-7.3.1
and -O3 in CFLAGS.

ntp_sources.c

index ff0be6e50415a29129092e2cd6fe8bd3a8bf1973..e7fb60fdb71acfdfaf13105dc5b099a1155cda60 100644 (file)
@@ -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;
 }
 
 /* ================================================== */