aboutsummaryrefslogtreecommitdiff
path: root/include/sqfs/predef.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/sqfs/predef.h')
-rw-r--r--include/sqfs/predef.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/sqfs/predef.h b/include/sqfs/predef.h
index f4b544b..39da692 100644
--- a/include/sqfs/predef.h
+++ b/include/sqfs/predef.h
@@ -162,6 +162,22 @@ static SQFS_INLINE void *sqfs_copy(const void *obj)
return NULL;
}
+/**
+ * @brief Initialize an object with default callbacks.
+ *
+ * @memberof sqfs_object_t
+ *
+ * @param obj A pointer to an uninitialized object
+ */
+static SQFS_INLINE
+void sqfs_object_init(void *obj,
+ void (*destroy_fn)(sqfs_object_t *),
+ sqfs_object_t *(*copy_fn)(const sqfs_object_t *))
+{
+ ((sqfs_object_t *)obj)->destroy = destroy_fn;
+ ((sqfs_object_t *)obj)->copy = copy_fn;
+}
+
#ifdef __cplusplus
extern "C" {
#endif