diff options
author | Timo Teräs <timo.teras@iki.fi> | 2021-07-27 15:34:04 +0300 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2021-07-27 16:28:22 +0300 |
commit | 5843daf7a1cdf15cbc76952c60a1d822414b2ef3 (patch) | |
tree | 46d5307df67341e3c8f90c3f3746f90c96da9459 /src/app_manifest.c | |
parent | 9c843e4ecdfee916ec835b5d35c10b3818aba9e3 (diff) | |
download | apk-tools-5843daf7a1cdf15cbc76952c60a1d822414b2ef3.tar.gz apk-tools-5843daf7a1cdf15cbc76952c60a1d822414b2ef3.tar.bz2 apk-tools-5843daf7a1cdf15cbc76952c60a1d822414b2ef3.tar.xz apk-tools-5843daf7a1cdf15cbc76952c60a1d822414b2ef3.zip |
Further refactor extract API to have separate ops vtable
This splits the callbacks by type, and further prepares the API
to be usable for v3 files too.
Diffstat (limited to 'src/app_manifest.c')
-rw-r--r-- | src/app_manifest.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/app_manifest.c b/src/app_manifest.c index ff63d7c..b1cbb3f 100644 --- a/src/app_manifest.c +++ b/src/app_manifest.c @@ -65,14 +65,13 @@ struct manifest_file_ctx { const char *prefix1, *prefix2; }; -static int read_file_entry(struct apk_extract_ctx *ectx, const struct apk_file_info *fi, struct apk_istream *is) +static int process_pkg_file(struct apk_extract_ctx *ectx, const struct apk_file_info *fi, struct apk_istream *is) { struct manifest_file_ctx *mctx = container_of(ectx, struct manifest_file_ctx, ectx); struct apk_out *out = mctx->out; char csum_buf[APK_BLOB_CHECKSUM_BUF]; apk_blob_t csum_blob = APK_BLOB_BUF(csum_buf); - if (ectx->metadata) return 0; if ((fi->mode & S_IFMT) != S_IFREG) return 0; memset(csum_buf, '\0', sizeof(csum_buf)); @@ -86,6 +85,11 @@ static int read_file_entry(struct apk_extract_ctx *ectx, const struct apk_file_i return 0; } +static const struct apk_extract_ops extract_manifest_ops = { + .v2meta = apk_extract_v2_meta, + .file = process_pkg_file, +}; + static void process_file(struct apk_database *db, const char *match) { struct apk_out *out = &db->ctx->out; @@ -96,7 +100,7 @@ static void process_file(struct apk_database *db, const char *match) }; int r; - apk_extract_init(&ctx.ectx, db->ctx, read_file_entry); + apk_extract_init(&ctx.ectx, db->ctx, &extract_manifest_ops); if (apk_out_verbosity(out) > 1) { ctx.prefix1 = match; ctx.prefix2 = ": "; |