From 62b85be2362608e8a7efc8170448937c6265cab3 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 29 Mar 2022 12:32:16 +0200 Subject: [PATCH] platform: make "idx" argument in _addr_array_clean_expired() mandatory There is only one caller of _addr_array_clean_expired(), and it always provides the "idx" pointer. (cherry picked from commit de9f174d51162ee32b648342eb841d8f77dc2d01) (cherry picked from commit 1f058668213fffd68126481c3fb1a45266806aea) --- src/libnm-platform/nm-platform.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/libnm-platform/nm-platform.c b/src/libnm-platform/nm-platform.c index d90fe20c58..99f0002fef 100644 --- a/src/libnm-platform/nm-platform.c +++ b/src/libnm-platform/nm-platform.c @@ -3678,14 +3678,13 @@ _addr_array_clean_expired(int addr_family, if (!nmp_utils_lifetime_get(a->timestamp, a->lifetime, a->preferred, cached_now, NULL)) goto clear_and_next; - if (idx) { - if (G_UNLIKELY(!*idx)) { - *idx = g_hash_table_new((GHashFunc) nmp_object_id_hash, - (GEqualFunc) nmp_object_id_equal); - } - if (!g_hash_table_add(*idx, (gpointer) NMP_OBJECT_UP_CAST(a))) - nm_assert_not_reached(); + if (G_UNLIKELY(!*idx)) { + *idx = + g_hash_table_new((GHashFunc) nmp_object_id_hash, (GEqualFunc) nmp_object_id_equal); } + if (!g_hash_table_add(*idx, (gpointer) NMP_OBJECT_UP_CAST(a))) + nm_assert_not_reached(); + any_addrs = TRUE; continue;