diff options
-rw-r--r-- | src/commit.c | 4 | ||||
-rw-r--r-- | src/database.c | 24 | ||||
-rw-r--r-- | src/package.c | 14 | ||||
-rw-r--r-- | test/error1.test | 2 | ||||
-rw-r--r-- | test/error3.test | 2 | ||||
-rw-r--r-- | test/error5.test | 4 |
6 files changed, 25 insertions, 25 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; diff --git a/test/error1.test b/test/error1.test index c99c7df..9060be9 100644 --- a/test/error1.test +++ b/test/error1.test @@ -5,4 +5,4 @@ add a d>1.5 ERROR: unsatisfiable constraints: d-2.0: breaks: b-1[d<2.0] - satisfies: world[d>1.5] c-1[d>1.0] + satisfies: world[d>1.5] a-3[d>1.5] c-1[d>1.0] diff --git a/test/error3.test b/test/error3.test index 9bd294d..8dfdd82 100644 --- a/test/error3.test +++ b/test/error3.test @@ -5,7 +5,7 @@ add a !b ERROR: unsatisfiable constraints: d-2.0: breaks: b-1[d<2.0] - satisfies: c-1[d>1.0] + satisfies: a-3[d>1.5] c-1[d>1.0] b-1: breaks: world[!b] satisfies: a-3[b] diff --git a/test/error5.test b/test/error5.test index 9aa1818..949fbe8 100644 --- a/test/error5.test +++ b/test/error5.test @@ -3,4 +3,6 @@ add a>2 @EXPECT ERROR: unsatisfiable constraints: - b-1: d<2.0 + d-1.5: + breaks: a-3[d>1.5] + satisfies: b-1[d<2.0] c-1[d>1.0] |