From fdebcfa0a0e32a15bce03e379a734ca5bac9dd89 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 27 Jul 2022 18:25:52 +0200 Subject: [PATCH] glib-aux: use different name for local variables in nm_g_array_index_p() macro This doesn't use NM_UNIQ_T() to create a truly unique name. Instead, it avoids "_arr" as local variable name, which other macros also use. By choosing a different name, we can nest such macro calls, without getting a "-Wshadow" warning. --- src/libnm-glib-aux/nm-shared-utils.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/libnm-glib-aux/nm-shared-utils.h b/src/libnm-glib-aux/nm-shared-utils.h index ab183d9ac..c59a40e47 100644 --- a/src/libnm-glib-aux/nm-shared-utils.h +++ b/src/libnm-glib-aux/nm-shared-utils.h @@ -2252,16 +2252,16 @@ nm_g_array_unref(GArray *arr) /* Similar to g_array_index(). The differences are * - this does nm_assert() checks that the arguments are valid. * - returns a pointer to the element. */ -#define nm_g_array_index_p(arr, Type, idx) \ - ({ \ - GArray *const _arr = (arr); \ - const guint _idx = (idx); \ - \ - nm_assert(_arr); \ - nm_assert(sizeof(Type) == g_array_get_element_size(_arr)); \ - nm_assert(_idx < _arr->len); \ - \ - &g_array_index(_arr, Type, _idx); \ +#define nm_g_array_index_p(arr, Type, idx) \ + ({ \ + GArray *const _arr_55 = (arr); \ + const guint _idx_55 = (idx); \ + \ + nm_assert(_arr_55); \ + nm_assert(sizeof(Type) == g_array_get_element_size(_arr_55)); \ + nm_assert(_idx_55 < _arr_55->len); \ + \ + &g_array_index(_arr_55, Type, _idx_55); \ }) #define nm_g_array_append_new(arr, Type) \