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 <michael.straube@posteo.de>
Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Michael Straube 2018-12-14 21:44:25 +01:00 committed by Allan McRae
parent 3a5a0d53bc
commit e1fc2f901e

View file

@ -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);