[pacman-dev] [PATCH v2 2/2] libalpm/add.c: move assignment into conditional in alpm_add_pkg
Michael Straube
michael.straube at posteo.de
Fri Dec 14 20:44:25 UTC 2018
While at it and for consistency move the assignment of the variable
'local' into the subsequent conditional.
Signed-off-by: Michael Straube <michael.straube at 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
More information about the pacman-dev
mailing list