From e1fc2f901ea7d70787d803ffb5c39fe7ad8bb92e Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Fri, 14 Dec 2018 21:44:25 +0100 Subject: libalpm/add.c: move assignment into conditional in alpm_add_pkg While at it and for consistency move the assignment of the variable 'local' into the subsequent conditional. Signed-off-by: Michael Straube Signed-off-by: Allan McRae --- lib/libalpm/add.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c index c39f9ecf..830fe077 100644 --- a/lib/libalpm/add.c +++ b/lib/libalpm/add.c @@ -80,8 +80,7 @@ int SYMEXPORT alpm_add_pkg(alpm_handle_t *handle, alpm_pkg_t *pkg) RET_ERR(handle, ALPM_ERR_TRANS_DUP_TARGET, -1); } - local = _alpm_db_get_pkgfromcache(handle->db_local, pkgname); - if(local) { + if((local = _alpm_db_get_pkgfromcache(handle->db_local, pkgname))) { const char *localpkgname = local->name; const char *localpkgver = local->version; int cmp = _alpm_pkg_compare_versions(pkg, local); -- cgit v1.2.3-70-g09d2