platform: use struct initializer instead of memset()

I think this is preferred over memset(), because it allows the
compiler to better unstand what is happening.

Also, strictly speaking in the C language, %NULL pointers are not
guaranteed to have an all zero bit pattern. Of course, that is already
required on any architecture where NetworkManager is running.
This commit is contained in:
Thomas Haller
2018-12-13 11:08:32 +01:00
parent 67f02b2a14
commit 8b9fd01ef3
2 changed files with 15 additions and 8 deletions

View File

@@ -1942,9 +1942,10 @@ _wireguard_update_from_allowed_ips_nla (NMPWireGuardAllowedIP *allowed_ip,
_check_addr_or_return_val (tb, WGALLOWEDIP_A_IPADDR, addr_len, FALSE);
memset (allowed_ip, 0, sizeof (NMPWireGuardAllowedIP));
*allowed_ip = (NMPWireGuardAllowedIP) {
.family = family,
};
allowed_ip->family = family;
nm_assert ((int) allowed_ip->family == family);
if (tb[WGALLOWEDIP_A_IPADDR])