summaryrefslogtreecommitdiff
path: root/lib/sqfs/comp/lz4.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-03-03 19:43:54 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-03-04 00:58:53 +0100
commit44c81eeffe9c8820b1009a7a5c728782aa5ebf40 (patch)
tree544eceb6dc5633018e5147c88ca9b07dd0fb54d9 /lib/sqfs/comp/lz4.c
parent6f47796dc0761fac359ec59ce26c7af5154e538d (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/lz4.c')
-rw-r--r--lib/sqfs/comp/lz4.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/sqfs/comp/lz4.c b/lib/sqfs/comp/lz4.c
index f298c67..460ac44 100644
--- a/lib/sqfs/comp/lz4.c
+++ b/lib/sqfs/comp/lz4.c
@@ -116,7 +116,7 @@ static void lz4_get_configuration(const sqfs_compressor_t *base,
cfg->flags |= SQFS_COMP_FLAG_UNCOMPRESS;
}
-static sqfs_compressor_t *lz4_create_copy(sqfs_compressor_t *cmp)
+static sqfs_object_t *lz4_create_copy(const sqfs_object_t *cmp)
{
lz4_compressor_t *lz4 = malloc(sizeof(*lz4));
@@ -124,7 +124,7 @@ static sqfs_compressor_t *lz4_create_copy(sqfs_compressor_t *cmp)
return NULL;
memcpy(lz4, cmp, sizeof(*lz4));
- return (sqfs_compressor_t *)lz4;
+ return (sqfs_object_t *)lz4;
}
static void lz4_destroy(sqfs_object_t *base)
@@ -155,7 +155,7 @@ sqfs_compressor_t *lz4_compressor_create(const sqfs_compressor_config_t *cfg)
lz4_uncomp_block : lz4_comp_block;
base->write_options = lz4_write_options;
base->read_options = lz4_read_options;
- base->create_copy = lz4_create_copy;
+ ((sqfs_object_t *)base)->copy = lz4_create_copy;
((sqfs_object_t *)base)->destroy = lz4_destroy;
return base;
}