diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/commit.c | 4 | ||||
-rw-r--r-- | src/database.c | 24 | ||||
-rw-r--r-- | src/package.c | 14 |
3 files changed, 20 insertions, 22 deletions
diff --git a/src/commit.c b/src/commit.c index a81bfc4..b8bf1a7 100644 --- a/src/commit.c +++ b/src/commit.c @@ -470,8 +470,8 @@ static void print_dep(struct apk_package *pkg0, struct apk_dependency *d0, struc static void print_deps(struct print_state *ps, struct apk_package *pkg, int match) { ps->match = match; - apk_pkg_foreach_matching_dependency(NULL, ps->world, ps->match, pkg, print_dep, ps); - apk_pkg_foreach_reverse_dependency(pkg, ps->match, print_dep, ps); + apk_pkg_foreach_matching_dependency(NULL, ps->world, match, pkg, print_dep, ps); + apk_pkg_foreach_reverse_dependency(pkg, match, print_dep, ps); label_end(ps); } 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; } diff --git a/src/package.c b/src/package.c index 85c67b4..0bbaead 100644 --- a/src/package.c +++ b/src/package.c @@ -401,7 +401,8 @@ int apk_dep_is_materialized_or_provided(struct apk_dependency *dep, struct apk_p int apk_dep_analyze(struct apk_dependency *dep, struct apk_package *pkg) { - int i; + struct apk_dependency *p; + struct apk_provider provider; if (pkg == NULL) return APK_DEP_IRRELEVANT; @@ -409,14 +410,11 @@ int apk_dep_analyze(struct apk_dependency *dep, struct apk_package *pkg) if (dep->name == pkg->name) return apk_dep_is_materialized(dep, pkg) ? APK_DEP_SATISFIES : APK_DEP_CONFLICTS; - for (i = 0; i < pkg->provides->num; i++) { - struct apk_provider p; - - if (pkg->provides->item[i].name != dep->name) + foreach_array_item(p, pkg->provides) { + if (p->name != dep->name) continue; - - p = APK_PROVIDER_FROM_PROVIDES(pkg, &pkg->provides->item[i]); - return apk_dep_is_provided(dep, &p) ? APK_DEP_SATISFIES : APK_DEP_CONFLICTS; + provider = APK_PROVIDER_FROM_PROVIDES(pkg, p); + return apk_dep_is_provided(dep, &provider) ? APK_DEP_SATISFIES : APK_DEP_CONFLICTS; } return APK_DEP_IRRELEVANT; |