about summary refs log tree commit diff
path: root/src/platform/nm-netlink.h
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2020-06-28 18:59:08 +0200
committerMichael Biebl <biebl@debian.org>2020-06-28 18:59:08 +0200
commit215112eefc83274273a10d9ddb5e107c9beec548 (patch)
treea16052cef4bb8707d6a906dd784a50c75945d03e /src/platform/nm-netlink.h
parent5ed4e66e01b005212aee22c255c9c6b2a4b040a9 (diff)
parenta54ac63bbf9b2c71026ac9028a8ffaf186cf3c82 (diff)
Update upstream source from tag 'upstream/1.25.90'
Update to upstream version '1.25.90'
with Debian dir 16d4caa71e8ba8c27ee163c88f11456b6cdc0490
Diffstat (limited to 'src/platform/nm-netlink.h')
-rw-r--r--src/platform/nm-netlink.h14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/platform/nm-netlink.h b/src/platform/nm-netlink.h
index 0ac5b3b7..a5124f52 100644
--- a/src/platform/nm-netlink.h
+++ b/src/platform/nm-netlink.h
@@ -77,17 +77,13 @@ struct nla_policy {
 /* static asserts that @tb and @policy are suitable arguments to nla_parse(). */
 #define _nl_static_assert_tb(tb, policy) \
 	G_STMT_START { \
-		\
 		G_STATIC_ASSERT_EXPR (G_N_ELEMENTS (tb) > 0); \
 		\
-		/* we allow @policy to be either NULL or a C array. */ \
-		G_STATIC_ASSERT_EXPR (   sizeof (policy) == sizeof (NULL) \
-		                      || G_N_ELEMENTS (tb) == (sizeof (policy) / sizeof (struct nla_policy))); \
-		\
-		/* For above check to work, we don't support policy being an array with same size as
-		 * sizeof(NULL), otherwise, the compile time check breaks down. */ \
-		G_STATIC_ASSERT_EXPR (sizeof (NULL) != G_N_ELEMENTS (tb) * sizeof (struct nla_policy)); \
-		\
+		/* We allow @policy to be either a C array or NULL. The sizeof()
+		 * must either match the expected array size or the sizeof(NULL),
+		 * but not both. */ \
+		G_STATIC_ASSERT_EXPR (  (sizeof (policy) == G_N_ELEMENTS (tb) * sizeof (struct nla_policy)) \
+		                      ^ (sizeof (policy) == sizeof (NULL))); \
 	} G_STMT_END
 
 /*****************************************************************************/