From f06edd885017fbe1cd23a6a8727581e8d6639396 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Tue, 11 Jun 2019 16:58:21 +0200 Subject: [PATCH] xbps_alternatives_register: no need to check for 'alloc'. Found by @huglovefan. Thanks. Signed-off-by: Juan RP --- lib/package_alternatives.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/lib/package_alternatives.c b/lib/package_alternatives.c index 3fd2875c..b981638c 100644 --- a/lib/package_alternatives.c +++ b/lib/package_alternatives.c @@ -461,14 +461,12 @@ xbps_alternatives_register(struct xbps_handle *xhp, xbps_dictionary_t pkg_repod) xbps_array_t array; xbps_object_t keysym; const char *keyname; - bool alloc = false; keysym = xbps_array_get(allkeys, i); keyname = xbps_dictionary_keysym_cstring_nocopy(keysym); array = xbps_dictionary_get(alternatives, keyname); if (array == NULL) { - alloc = true; array = xbps_array_create(); } else { /* already registered */ @@ -487,15 +485,13 @@ xbps_alternatives_register(struct xbps_handle *xhp, xbps_dictionary_t pkg_repod) xbps_dictionary_set(alternatives, keyname, array); xbps_set_cb_state(xhp, XBPS_STATE_ALTGROUP_ADDED, 0, NULL, "%s: registered '%s' alternatives group", pkgver, keyname); - if (alloc) { - /* apply alternatives for this group */ - rv = create_symlinks(xhp, - xbps_dictionary_get(pkg_alternatives, keyname), - keyname); - xbps_object_release(array); - if (rv != 0) - break; - } + /* apply alternatives for this group */ + rv = create_symlinks(xhp, + xbps_dictionary_get(pkg_alternatives, keyname), + keyname); + xbps_object_release(array); + if (rv != 0) + break; } xbps_object_release(allkeys); free(pkgname);