summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMichael Straube <michael.straube@posteo.de>2018-12-14 21:44:25 +0100
committerAllan McRae <allan@archlinux.org>2019-01-04 02:32:49 +0100
commite1fc2f901ea7d70787d803ffb5c39fe7ad8bb92e (patch)
tree8167a46051a029d4b664539ab866190142c8448b /lib
parent3a5a0d53bced32b42fd553952c2f74d52981d9ef (diff)
downloadpacman-e1fc2f901ea7d70787d803ffb5c39fe7ad8bb92e.tar.gz
pacman-e1fc2f901ea7d70787d803ffb5c39fe7ad8bb92e.tar.xz
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>
Diffstat (limited to 'lib')
-rw-r--r--lib/libalpm/add.c3
1 files changed, 1 insertions, 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);