summaryrefslogtreecommitdiff
path: root/src/package.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2013-06-13 21:58:54 +0300
committerTimo Teräs <timo.teras@iki.fi>2013-06-13 21:59:08 +0300
commit59d15ab2599777b24e65fad7a1fb052de4f5ef38 (patch)
tree4b66c5254f346df3cb1675d3b1da9a50250d53cd /src/package.c
parent2ff59b7c23d81d819d8b2dc3268ee70f0cb4d71b (diff)
downloadapk-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/package.c')
-rw-r--r--src/package.c14
1 files changed, 6 insertions, 8 deletions
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;