From c64053e6e66d9ea67721fe424eb852997056cbfb Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 28 Oct 2022 21:10:20 +0200 Subject: [PATCH] platform: minor cleanup in nmp_cache_update_netlink_route() It reads nicer. It will also work better with the change that follows. --- src/libnm-platform/nmp-object.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/libnm-platform/nmp-object.c b/src/libnm-platform/nmp-object.c index 65dd06b4de..ea1d12df0e 100644 --- a/src/libnm-platform/nmp-object.c +++ b/src/libnm-platform/nmp-object.c @@ -2990,17 +2990,16 @@ nmp_cache_update_netlink_route(NMPCache *cache, NM_SET_OUT(out_obj_old, nmp_object_ref(nm_dedup_multi_entry_get_obj(entry_old))); - if (!entry_old) { - if (!nmp_object_is_alive(obj_hand_over)) - goto update_done; + is_alive = nmp_object_is_alive(obj_hand_over); - _idxcache_update(cache, NULL, obj_hand_over, is_dump, &entry_new); - ops_type = NMP_CACHE_OPS_ADDED; + if (!entry_old) { + if (is_alive) { + _idxcache_update(cache, NULL, obj_hand_over, is_dump, &entry_new); + ops_type = NMP_CACHE_OPS_ADDED; + } goto update_done; } - is_alive = nmp_object_is_alive(obj_hand_over); - if (!is_alive) { /* the update would make @entry_old invalid. Remove it. */ _idxcache_update(cache, entry_old, NULL, FALSE, NULL);