aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2021-03-07 18:05:41 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2021-03-07 18:05:41 +0100
commit8f79a36a592c796c19037a2513c6fc7098698dee (patch)
treefabf129af336a5c5eac03948203b360816dea53a /include
parentb76eae105fbd0246d02a19438a337fe5be910f65 (diff)
Implement a custom memory pool allocator
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'include')
-rw-r--r--include/mempool.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/include/mempool.h b/include/mempool.h
new file mode 100644
index 0000000..6d3990e
--- /dev/null
+++ b/include/mempool.h
@@ -0,0 +1,30 @@
+/* SPDX-License-Identifier: LGPL-3.0-or-later */
+/*
+ * mempool.h
+ *
+ * Copyright (C) 2021 David Oberhollenzer <goliath@infraroot.at>
+ */
+#ifndef MEMPOOL_H
+#define MEMPOOL_H
+
+#include "compat.h"
+
+typedef struct mem_pool_t mem_pool_t;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+mem_pool_t *mem_pool_create(size_t obj_size);
+
+void mem_pool_destroy(mem_pool_t *mem);
+
+void *mem_pool_allocate(mem_pool_t *mem);
+
+void mem_pool_free(mem_pool_t *mem, void *ptr);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* MEMPOOL_H */