aboutsummaryrefslogtreecommitdiff
path: root/lib/common
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2022-12-04 00:39:47 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2023-01-19 16:24:56 +0100
commit4160b50a0b4c51f8b7191928cdf38d9fb0147fe2 (patch)
tree996998b7fe506101c8d91aeb71891eaac358902e /lib/common
parent42194bf57d470e548e03c44f5c2340d7d23a3ecb (diff)
Add a helper function to initialize libsquashfs objects
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/common')
-rw-r--r--lib/common/comp_lzo.c4
-rw-r--r--lib/common/data_writer_ostream.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/lib/common/comp_lzo.c b/lib/common/comp_lzo.c
index 92a081c..2021d34 100644
--- a/lib/common/comp_lzo.c
+++ b/lib/common/comp_lzo.c
@@ -266,6 +266,8 @@ int lzo_compressor_create(const sqfs_compressor_config_t *cfg,
if (lzo == NULL)
return SQFS_ERROR_ALLOC;
+ sqfs_object_init(lzo, lzo_destroy, lzo_create_copy);
+
lzo->block_size = cfg->block_size;
lzo->algorithm = cfg->opt.lzo.algorithm;
lzo->level = cfg->level;
@@ -277,8 +279,6 @@ int lzo_compressor_create(const sqfs_compressor_config_t *cfg,
lzo_uncomp_block : lzo_comp_block;
base->write_options = lzo_write_options;
base->read_options = lzo_read_options;
- ((sqfs_object_t *)base)->copy = lzo_create_copy;
- ((sqfs_object_t *)base)->destroy = lzo_destroy;
*out = base;
return 0;
diff --git a/lib/common/data_writer_ostream.c b/lib/common/data_writer_ostream.c
index 94a04f2..fbd0431 100644
--- a/lib/common/data_writer_ostream.c
+++ b/lib/common/data_writer_ostream.c
@@ -64,7 +64,6 @@ ostream_t *data_writer_ostream_create(const char *filename,
int flags)
{
data_writer_ostream_t *strm = calloc(1, sizeof(*strm));
- sqfs_object_t *obj = (sqfs_object_t *)strm;
ostream_t *base = (ostream_t *)strm;
int ret;
@@ -73,6 +72,8 @@ ostream_t *data_writer_ostream_create(const char *filename,
return NULL;
}
+ sqfs_object_init(strm, stream_destroy, NULL);
+
ret = sqfs_block_processor_begin_file(proc, inode, NULL, flags);
if (ret != 0) {
@@ -86,6 +87,5 @@ ostream_t *data_writer_ostream_create(const char *filename,
base->append = stream_append;
base->flush = stream_flush;
base->get_filename = stream_get_filename;
- obj->destroy = stream_destroy;
return base;
}