From f7b2ebc87adc1a4afae8c89a7ebd94e7e03374ce Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 14 Mar 2018 09:10:49 +0100 Subject: [PATCH] shared: fix typecheck in NM_PTRARRAY_LEN() Previously, NM_PTRARRAY_LEN() would not work if the pointer type is an opaque type, which is common. For example: NMConnection *const*connections = ...; --- shared/nm-utils/nm-macros-internal.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/shared/nm-utils/nm-macros-internal.h b/shared/nm-utils/nm-macros-internal.h index f0d7374eb..2e3940fd7 100644 --- a/shared/nm-utils/nm-macros-internal.h +++ b/shared/nm-utils/nm-macros-internal.h @@ -271,7 +271,8 @@ NM_G_ERROR_MSG (GError *error) gsize _n = 0; \ \ if (_array) { \ - _nm_unused typeof (*(_array[0])) *_array_check = _array[0]; \ + _nm_unused gconstpointer _type_check_is_pointer = _array[0]; \ + \ while (_array[_n]) \ _n++; \ } \