shared: avoid "-Wmissing-braces" warning initalizing NMIPAddr

NMIPAddr contains an unnamed union. We have to either explicitly
initialize one field, or omit it.

    ../shared/nm-utils/nm-shared-utils.c:38:36: error: suggest braces around initialization of subobject [-Werror,-Wmissing-braces]
    const NMIPAddr nm_ip_addr_zero = { 0 };
                                       ^
                                       {}
This commit is contained in:
Thomas Haller 2019-02-08 12:24:07 +01:00
parent 814bcf5575
commit 395174f659
3 changed files with 6 additions and 5 deletions

View file

@ -35,7 +35,7 @@ const void *const _NM_PTRARRAY_EMPTY[1] = { NULL };
/*****************************************************************************/
const NMIPAddr nm_ip_addr_zero = { 0 };
const NMIPAddr nm_ip_addr_zero = { };
/*****************************************************************************/

View file

@ -380,7 +380,8 @@ route_compare (NMIPRoute *route1, NMIPRoute *route2, gint64 default_metric)
gint64 r, metric1, metric2;
int family;
guint plen;
NMIPAddr a1 = { 0 }, a2 = { 0 };
NMIPAddr a1;
NMIPAddr a2;
family = nm_ip_route_get_family (route1);
r = family - nm_ip_route_get_family (route2);
@ -408,7 +409,7 @@ route_compare (NMIPRoute *route1, NMIPRoute *route2, gint64 default_metric)
inet_pton (family, nm_ip_route_get_dest (route2), &a2);
nm_utils_ipx_address_clear_host_address (family, &a1, &a1, plen);
nm_utils_ipx_address_clear_host_address (family, &a2, &a2, plen);
r = memcmp (&a1, &a2, sizeof (a1));
r = memcmp (&a1, &a2, nm_utils_addr_family_to_size (family));
if (r)
return r;

View file

@ -518,8 +518,8 @@ parse_rd_route (GHashTable *connections, char *argument)
const char *gateway;
const char *interface;
int family = AF_UNSPEC;
NMIPAddr net_addr = { 0, };
NMIPAddr gateway_addr = { 0, };
NMIPAddr net_addr = { };
NMIPAddr gateway_addr = { };
int net_prefix = -1;
NMIPRoute *route;
NMSettingIPConfig *s_ip;