While at it and for consistency move the assignment of the variable
'local' into the subsequent conditional.

Signed-off-by: Michael Straube <michael.stra...@posteo.de>
---
 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);
-- 
2.20.0

Reply via email to