Skip to content
Snippets Groups Projects
Commit 7f8a1ca1 authored by Timo Teräs's avatar Timo Teräs
Browse files

list, search: fix origin existence checks

Origin is an atom and is always non-null, check the length instead.
parent 00522cd6
No related branches found
No related tags found
No related merge requests found
......@@ -35,8 +35,7 @@ static int origin_matches(const struct list_ctx *ctx, const struct apk_package *
{
char **pmatch;
if (pkg->origin == NULL)
return 0;
if (pkg->origin->len == 0) return 0;
foreach_array_item(pmatch, ctx->filters) {
if (apk_blob_compare(APK_BLOB_STR(*pmatch), *pkg->origin) == 0)
......@@ -77,7 +76,7 @@ static void print_package(const struct apk_database *db, const struct apk_packag
printf(PKG_VER_FMT " " BLOB_FMT " ",
PKG_VER_PRINTF(pkg), BLOB_PRINTF(*pkg->arch));
if (pkg->origin != NULL)
if (pkg->origin->len)
printf("{" BLOB_FMT "}", BLOB_PRINTF(*pkg->origin));
else
printf("{%s}", pkg->name->name);
......
......@@ -41,7 +41,7 @@ static void print_package_name(struct search_ctx *ctx, struct apk_package *pkg)
static void print_origin_name(struct search_ctx *ctx, struct apk_package *pkg)
{
if (pkg->origin != NULL)
if (pkg->origin->len)
printf(BLOB_FMT, BLOB_PRINTF(*pkg->origin));
else
printf("%s", pkg->name->name);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment