diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2020-03-03 19:43:54 +0100 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2020-03-04 00:58:53 +0100 |
commit | 44c81eeffe9c8820b1009a7a5c728782aa5ebf40 (patch) | |
tree | 544eceb6dc5633018e5147c88ca9b07dd0fb54d9 /lib/sqfs/comp/zstd.c | |
parent | 6f47796dc0761fac359ec59ce26c7af5154e538d (diff) |
Add a generic copying mechanism to sqfs_object_t
This patch adds a deep-copy callback to sqfs_object_t and removes the
copying mechanism from sqfs_compressor_t. This is also interesting for
other types.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/sqfs/comp/zstd.c')
-rw-r--r-- | lib/sqfs/comp/zstd.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/sqfs/comp/zstd.c b/lib/sqfs/comp/zstd.c index e01f87d..12ddfdb 100644 --- a/lib/sqfs/comp/zstd.c +++ b/lib/sqfs/comp/zstd.c @@ -107,7 +107,7 @@ static void zstd_get_configuration(const sqfs_compressor_t *base, cfg->flags |= SQFS_COMP_FLAG_UNCOMPRESS; } -static sqfs_compressor_t *zstd_create_copy(sqfs_compressor_t *cmp) +static sqfs_object_t *zstd_create_copy(const sqfs_object_t *cmp) { zstd_compressor_t *zstd = malloc(sizeof(*zstd)); @@ -123,7 +123,7 @@ static sqfs_compressor_t *zstd_create_copy(sqfs_compressor_t *cmp) return NULL; } - return (sqfs_compressor_t *)zstd; + return (sqfs_object_t *)zstd; } static void zstd_destroy(sqfs_object_t *base) @@ -164,7 +164,7 @@ sqfs_compressor_t *zstd_compressor_create(const sqfs_compressor_config_t *cfg) zstd_uncomp_block : zstd_comp_block; base->write_options = zstd_write_options; base->read_options = zstd_read_options; - base->create_copy = zstd_create_copy; + ((sqfs_object_t *)base)->copy = zstd_create_copy; ((sqfs_object_t *)base)->destroy = zstd_destroy; return base; } |