From 303680ebcd5adaac2934b63a0edc2d9d1a36d7fb Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Wed, 12 Feb 2020 02:22:31 +0100 Subject: Implement a more explicit object system Make every dynamically allocated, opaque data structure inherit from a common sqfs_object_t structure with common entry points (e.g. destroy). This removes tons of public API functions and replaces them with a simple sqfs_destroy instead. If semantics of the (until now implicit) object system need to be extended, it can be much more conveniantely done this way. Signed-off-by: David Oberhollenzer --- include/sqfs/compressor.h | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'include/sqfs/compressor.h') diff --git a/include/sqfs/compressor.h b/include/sqfs/compressor.h index 5e0be5d..c0fafda 100644 --- a/include/sqfs/compressor.h +++ b/include/sqfs/compressor.h @@ -32,16 +32,13 @@ /** * @interface sqfs_compressor_t * + * @extends sqfs_object_t + * * @brief Encapsultes a compressor with a simple interface to compress or * extract chunks of data. */ struct sqfs_compressor_t { - /** - * @brief Destroy a compressor and free all memory used by it. - * - * @param cmp A pointer to a compressor object. - */ - void (*destroy)(sqfs_compressor_t *cmp); + sqfs_object_t base; /** * @brief Write compressor options to disk if non-default settings -- cgit v1.2.3