summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAllan McRae <allan@archlinux.org>2010-03-24 15:59:04 +1000
committerDan McGee <dan@archlinux.org>2010-03-25 21:32:48 -0500
commit98ee520907f7f2a50fa43edfd213dfc8eae07033 (patch)
tree9293ba6dfb3757d003ded8240f3ed19b71b5cbfd /lib
parent526806e7acf07f625da3a2a31de94b7ca150e4b7 (diff)
Sort and avoid duplicates in -Sii output
Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/libalpm/package.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c
index f1682cbc..ed6d71d0 100644
--- a/lib/libalpm/package.c
+++ b/lib/libalpm/package.c
@@ -565,7 +565,9 @@ static void find_requiredby(pmpkg_t *pkg, pmdb_t *db, alpm_list_t **reqs)
pmpkg_t *cachepkg = i->data;
if(_alpm_dep_edge(cachepkg, pkg)) {
const char *cachepkgname = cachepkg->name;
- *reqs = alpm_list_add(*reqs, strdup(cachepkgname));
+ if(alpm_list_find_str(*reqs, cachepkgname) == 0) {
+ *reqs = alpm_list_add(*reqs, strdup(cachepkgname));
+ }
}
}
}
@@ -595,6 +597,7 @@ alpm_list_t SYMEXPORT *alpm_pkg_compute_requiredby(pmpkg_t *pkg)
for(i = handle->dbs_sync; i; i = i->next) {
db = i->data;
find_requiredby(pkg, db, &reqs);
+ reqs = alpm_list_msort(reqs, alpm_list_count(reqs), _alpm_str_cmp);
}
}
}