summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2019-02-08 12:24:07 +0100
committerThomas Haller <thaller@redhat.com>2019-02-08 20:14:50 +0100
commit395174f6597685eed10768ed0866015f72d2b7a1 (patch)
treef807b21822859642235edd226fcfcdc1a9390f2c
parent814bcf5575c06219480139ec3237ec62f781533f (diff)
downloadNetworkManager-395174f6597685eed10768ed0866015f72d2b7a1.tar.gz
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 }; ^ {}
-rw-r--r--shared/nm-utils/nm-shared-utils.c2
-rw-r--r--src/NetworkManagerUtils.c5
-rw-r--r--src/initrd/nmi-cmdline-reader.c4
3 files changed, 6 insertions, 5 deletions
diff --git a/shared/nm-utils/nm-shared-utils.c b/shared/nm-utils/nm-shared-utils.c
index 23c16b6b44..288c96a4f8 100644
--- a/shared/nm-utils/nm-shared-utils.c
+++ b/shared/nm-utils/nm-shared-utils.c
@@ -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 = { };
/*****************************************************************************/
diff --git a/src/NetworkManagerUtils.c b/src/NetworkManagerUtils.c
index fc0c5b8d3b..ed5de3eb6d 100644
--- a/src/NetworkManagerUtils.c
+++ b/src/NetworkManagerUtils.c
@@ -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;
diff --git a/src/initrd/nmi-cmdline-reader.c b/src/initrd/nmi-cmdline-reader.c
index e812b086b9..ffd460509b 100644
--- a/src/initrd/nmi-cmdline-reader.c
+++ b/src/initrd/nmi-cmdline-reader.c
@@ -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;