summaryrefslogtreecommitdiff
path: root/src/search.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2013-06-14 20:26:48 +0300
committerTimo Teräs <timo.teras@iki.fi>2013-06-14 20:26:48 +0300
commitedf03b155ba419b00dde585b3d35969621a024df (patch)
treec397c917cd6898101cd840790f2e24523057e14d /src/search.c
parent59d15ab2599777b24e65fad7a1fb052de4f5ef38 (diff)
downloadapk-tools-edf03b155ba419b00dde585b3d35969621a024df.tar.gz
apk-tools-edf03b155ba419b00dde585b3d35969621a024df.tar.bz2
apk-tools-edf03b155ba419b00dde585b3d35969621a024df.tar.xz
apk-tools-edf03b155ba419b00dde585b3d35969621a024df.zip
audit, index, search, upgrade: use foreach_array_item
Diffstat (limited to 'src/search.c')
-rw-r--r--src/search.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/search.c b/src/search.c
index 9ef61a1..2f39f38 100644
--- a/src/search.c
+++ b/src/search.c
@@ -119,16 +119,14 @@ static void print_result_pkg(struct search_ctx *ctx, struct apk_package *pkg)
static void print_result(struct search_ctx *ctx, struct apk_name *name)
{
- int i;
+ struct apk_provider *p;
+ struct apk_package *pkg = NULL;
+ apk_blob_t *version = NULL;
if (ctx->show_all) {
- for (i = 0; i < name->providers->num; i++)
- print_result_pkg(ctx, name->providers->item[i].pkg);
+ foreach_array_item(p, name->providers)
+ print_result_pkg(ctx, p->pkg);
} else {
- struct apk_package *pkg = NULL;
- struct apk_provider *p;
- apk_blob_t *version = NULL;
-
foreach_array_item(p, name->providers) {
if (version == NULL ||
apk_version_compare_blob(*p->version, *version) == APK_VERSION_GREATER)