From 77a4c150bb6ce20ddddaa5f4e75b964ccfac8978 Mon Sep 17 00:00:00 2001 From: Rasmus Villemoes Date: Thu, 8 Jun 2017 10:59:20 +0200 Subject: [PATCH] lib/cache_mgr.c: remove pointless goto The only way we can enter the block containing this goto is if i is equal to (the old value of) mngr->cm_nassocs, and that slot is now guaranteed to exist and be vacant after the succesful realloc call, while no earlier slots can have become available [there's no locking involved, so I assume that avoiding concurrent operations on a struct nl_cache_mngr is up to the caller]. --- lib/cache_mngr.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/cache_mngr.c b/lib/cache_mngr.c index 2d7623c..6aca520 100644 --- a/lib/cache_mngr.c +++ b/lib/cache_mngr.c @@ -311,7 +311,6 @@ int nl_cache_mngr_add_cache(struct nl_cache_mngr *mngr, struct nl_cache *cache, mngr->cm_assocs[i].ca_cache->c_ops == ops) return -NLE_EXIST; -retry: for (i = 0; i < mngr->cm_nassocs; i++) if (!mngr->cm_assocs[i].ca_cache) break; @@ -332,7 +331,6 @@ retry: NL_DBG(1, "Increased capacity of cache manager %p " \ "to %d\n", mngr, mngr->cm_nassocs); - goto retry; } for (grp = ops->co_groups; grp->ag_group; grp++) { -- 2.40.0