summaryrefslogtreecommitdiff
path: root/src/nm-ip6-config.c
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2017-12-11 18:21:34 +0100
committerThomas Haller <thaller@redhat.com>2017-12-15 11:48:38 +0100
commitea1f77f91163e86265a1e1a34577ce2db8ca57ea (patch)
treea0c06e4b8a12a71da82462cf95aa440edcaf6ff9 /src/nm-ip6-config.c
parentc696a226ea5410da48677b47b21256987fe8ecd4 (diff)
downloadNetworkManager-ea1f77f91163e86265a1e1a34577ce2db8ca57ea.tar.gz
core: don't use variable length arrays
Let's compile with -Wvla, so that G_STATIC_ASSERT() is really static. But then we cannot use variable length arrays.
Diffstat (limited to 'src/nm-ip6-config.c')
-rw-r--r--src/nm-ip6-config.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/nm-ip6-config.c b/src/nm-ip6-config.c
index 7c6b0ee604..d2a08d0ceb 100644
--- a/src/nm-ip6-config.c
+++ b/src/nm-ip6-config.c
@@ -2477,9 +2477,9 @@ nm_ip6_config_equal (const NMIP6Config *a, const NMIP6Config *b)
{
GChecksum *a_checksum = g_checksum_new (G_CHECKSUM_SHA1);
GChecksum *b_checksum = g_checksum_new (G_CHECKSUM_SHA1);
- gsize a_len = g_checksum_type_get_length (G_CHECKSUM_SHA1);
- gsize b_len = g_checksum_type_get_length (G_CHECKSUM_SHA1);
- guchar a_data[a_len], b_data[b_len];
+ guchar a_data[20], b_data[20];
+ gsize a_len = sizeof (a_data);
+ gsize b_len = sizeof (b_data);
gboolean equal;
if (a)
@@ -2490,7 +2490,8 @@ nm_ip6_config_equal (const NMIP6Config *a, const NMIP6Config *b)
g_checksum_get_digest (a_checksum, a_data, &a_len);
g_checksum_get_digest (b_checksum, b_data, &b_len);
- g_assert (a_len == b_len);
+ nm_assert (a_len == sizeof (a_data));
+ nm_assert (b_len == sizeof (b_data));
equal = !memcmp (a_data, b_data, a_len);
g_checksum_free (a_checksum);