diff options
-rw-r--r-- | src/list.c | 40 |
1 files changed, 20 insertions, 20 deletions
@@ -125,36 +125,36 @@ static void print_package(const struct apk_package *pkg, const struct list_ctx * printf("\n"); } -static void print_result(struct apk_database *db, const char *match, struct apk_name *name, void *pctx) +static void filter_package(const struct apk_package *pkg, const struct list_ctx *ctx) { - struct list_ctx *ctx = pctx; - struct apk_provider *p; - struct apk_package *pkg; + if (ctx->match_origin && !origin_matches(ctx, pkg)) + return; - if (name == NULL) + if (ctx->installed && pkg->ipkg == NULL) return; - foreach_array_item(p, name->providers) - { - pkg = p->pkg; + if (ctx->orphaned && !is_orphaned(pkg->name)) + return; - if (ctx->match_origin && !origin_matches(ctx, pkg)) - continue; + if (ctx->available && pkg->repos == BIT(1)) + return; - if (ctx->installed && pkg->ipkg == NULL) - continue; + if (ctx->upgradable && !is_upgradable(pkg->name, pkg)) + return; - if (ctx->orphaned && !is_orphaned(name)) - continue; + print_package(pkg, ctx); +} - if (ctx->available && pkg->repos == BIT(1)) - continue; +static void print_result(struct apk_database *db, const char *match, struct apk_name *name, void *pctx) +{ + struct list_ctx *ctx = pctx; + struct apk_provider *p; - if (ctx->upgradable && !is_upgradable(name, pkg)) - continue; + if (name == NULL) + return; - print_package(pkg, ctx); - } + foreach_array_item(p, name->providers) + filter_package(p->pkg, ctx); } static int option_parse_applet(void *pctx, struct apk_db_options *dbopts, int optch, const char *optarg) |