summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Gregory <andrew.gregory.8@gmail.com>2013-05-04 09:37:38 -0400
committerAllan McRae <allan@archlinux.org>2013-05-05 07:45:33 +1000
commitc5716d0e72e47c8cd2ca1a437598eeee54111754 (patch)
treed11f95ad4048c0feb6a2bbc64d76a85d8146574a
parent9de33488bffffd4bb273f73f98a0ced40ba06f29 (diff)
downloadpacman-c5716d0e72e47c8cd2ca1a437598eeee54111754.tar.xz
conflict.c: compare package pointers directly
p1 and p2 both come directly from the upgrade list without being copied so they can be compared directly instead of comparing their names. Also fix minor style violation. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
-rw-r--r--lib/libalpm/conflict.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/libalpm/conflict.c b/lib/libalpm/conflict.c
index 18e29a89..041a04ef 100644
--- a/lib/libalpm/conflict.c
+++ b/lib/libalpm/conflict.c
@@ -556,11 +556,13 @@ alpm_list_t *_alpm_db_find_fileconflicts(alpm_handle_t *handle,
/* Look at all the targets to see if file has changed hands */
for(k = upgrade; k && !resolved_conflict; k = k->next) {
- alpm_pkg_t *p2 = k->data;
- if(!p2 || strcmp(p1->name, p2->name) == 0) {
+ alpm_pkg_t *localp2, *p2 = k->data;
+ if(!p2 || p1 == p2) {
+ /* skip p1; both p1 and p2 come directly from the upgrade list
+ * so they can be compared directly */
continue;
}
- alpm_pkg_t *localp2 = _alpm_db_get_pkgfromcache(handle->db_local, p2->name);
+ localp2 = _alpm_db_get_pkgfromcache(handle->db_local, p2->name);
/* localp2->files will be removed (target conflicts are handled by CHECK 1) */
_alpm_filelist_resolve(handle, alpm_pkg_get_files(localp2));