diff options
author | Thomas Haller <thaller@redhat.com> | 2018-03-14 09:10:49 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2018-03-20 15:08:18 +0100 |
commit | f7b2ebc87adc1a4afae8c89a7ebd94e7e03374ce (patch) | |
tree | 5b36363cf93bd5f2ebfb66d484a94620d3f3eebc | |
parent | 39ab38a04d580b3d9eeae0d242b7ac9b4fb53378 (diff) | |
download | NetworkManager-f7b2ebc87adc1a4afae8c89a7ebd94e7e03374ce.tar.gz |
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 = ...;
-rw-r--r-- | shared/nm-utils/nm-macros-internal.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/shared/nm-utils/nm-macros-internal.h b/shared/nm-utils/nm-macros-internal.h index f0d7374eb4..2e3940fd76 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++; \ } \ |