diff options
author | Timo Teräs <timo.teras@iki.fi> | 2013-06-13 21:58:54 +0300 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2013-06-13 21:59:08 +0300 |
commit | 59d15ab2599777b24e65fad7a1fb052de4f5ef38 (patch) | |
tree | 4b66c5254f346df3cb1675d3b1da9a50250d53cd /src/database.c | |
parent | 2ff59b7c23d81d819d8b2dc3268ee70f0cb4d71b (diff) | |
download | apk-tools-59d15ab2599777b24e65fad7a1fb052de4f5ef38.tar.gz apk-tools-59d15ab2599777b24e65fad7a1fb052de4f5ef38.tar.bz2 apk-tools-59d15ab2599777b24e65fad7a1fb052de4f5ef38.tar.xz apk-tools-59d15ab2599777b24e65fad7a1fb052de4f5ef38.zip |
solver, errors: fix few additional test cases and clean ups
Diffstat (limited to 'src/database.c')
-rw-r--r-- | src/database.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/database.c b/src/database.c index a77e409..c4f8433 100644 --- a/src/database.c +++ b/src/database.c @@ -496,25 +496,25 @@ static struct apk_db_file *apk_db_file_get(struct apk_database *db, static void apk_db_pkg_rdepends(struct apk_database *db, struct apk_package *pkg) { - int i, j; - struct apk_name *rname; + struct apk_name *rname, **rd; + struct apk_dependency *d; - for (i = 0; i < pkg->depends->num; i++) { - rname = pkg->depends->item[i].name; - for (j = 0; j < rname->rdepends->num; j++) - if (rname->rdepends->item[j] == pkg->name) + foreach_array_item(d, pkg->depends) { + rname = d->name; + foreach_array_item(rd, rname->rdepends) + if (*rd == pkg->name) goto rdeps_done; *apk_name_array_add(&rname->rdepends) = pkg->name; +rdeps_done: ; } -rdeps_done: - for (i = 0; i < pkg->install_if->num; i++) { - rname = pkg->install_if->item[i].name; - for (j = 0; j < rname->rinstall_if->num; j++) - if (rname->rinstall_if->item[j] == pkg->name) + foreach_array_item(d, pkg->install_if) { + rname = d->name; + foreach_array_item(rd, rname->rinstall_if) + if (*rd == pkg->name) goto riif_done; *apk_name_array_add(&rname->rinstall_if) = pkg->name; +riif_done: ; } -riif_done: return; } |