summaryrefslogtreecommitdiff
path: root/include/sqfs/predef.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/sqfs/predef.h')
-rw-r--r--include/sqfs/predef.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/include/sqfs/predef.h b/include/sqfs/predef.h
index d8cc293..6ca3503 100644
--- a/include/sqfs/predef.h
+++ b/include/sqfs/predef.h
@@ -57,6 +57,12 @@
#endif
#endif
+#ifdef _MSC_VER
+ #define SQFS_INLINE __forceinline
+#else
+ #define SQFS_INLINE __inline__ __attribute__((always_inline))
+#endif
+
typedef uint8_t sqfs_u8;
typedef uint16_t sqfs_u16;
typedef uint32_t sqfs_u32;
@@ -108,4 +114,25 @@ typedef struct sqfs_xattr_value_t sqfs_xattr_value_t;
typedef struct sqfs_xattr_id_t sqfs_xattr_id_t;
typedef struct sqfs_xattr_id_table_t sqfs_xattr_id_table_t;
+/**
+ * @interface sqfs_object_t
+ *
+ * @brief Base interface for all libsquashfs in-memory data structures.
+ */
+typedef struct sqfs_object_t {
+ void (*destroy)(struct sqfs_object_t *instance);
+} sqfs_object_t;
+
+/**
+ * @brief Destroy an object and free all its memory
+ *
+ * @memberof sqfs_object_t
+ *
+ * @param obj A pointer to an object
+ */
+static SQFS_INLINE void sqfs_destroy(void *obj)
+{
+ ((sqfs_object_t *)obj)->destroy(obj);
+}
+
#endif /* SQFS_PREDEF_H */