From 4087024a9b1dcad5c819cde0d2902b94f6beeef4 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 2 Mar 2020 16:17:32 +0100 Subject: [PATCH] shared: move assertion in _NM_UTILS_STRING_TABLE_LOOKUP_DEFINE() Move the assertion for valid LIST first. It only checks static data, and regardless of the entry_cmd, it should be done first. Fixes: f4d12f7b59b6 ('shared: add NM_UTILS_STRING_TABLE_LOOKUP_STRUCT_DEFINE() macro for lookup of structs') --- shared/nm-glib-aux/nm-shared-utils.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shared/nm-glib-aux/nm-shared-utils.h b/shared/nm-glib-aux/nm-shared-utils.h index 63badb3cd..115f9179d 100644 --- a/shared/nm-glib-aux/nm-shared-utils.h +++ b/shared/nm-glib-aux/nm-shared-utils.h @@ -1564,8 +1564,6 @@ fcn_name (const char *name) \ __VA_ARGS__ \ }; \ \ - { entry_cmd; } \ - \ if (NM_MORE_ASSERT_ONCE (5)) { \ int i; \ \ @@ -1576,6 +1574,8 @@ fcn_name (const char *name) \ } \ } \ \ + { entry_cmd; } \ + \ if (G_LIKELY (name)) { \ G_STATIC_ASSERT (G_N_ELEMENTS (LIST) > 1); \ G_STATIC_ASSERT (G_N_ELEMENTS (LIST) < G_MAXUINT / 2u - 10u); \