aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/alloc.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/alloc.h b/include/alloc.h
index 966361e..b9e03e2 100644
--- a/include/alloc.h
+++ b/include/alloc.h
@@ -1,6 +1,7 @@
#ifndef MLIB_ALLOC_H
#define MLIB_ALLOC_H
+#include <setjmp.h>
#include <stddef.h>
#include "_attrs.h"
@@ -44,6 +45,15 @@ void arena_free(arena *);
#define arena_resz(a, T, p, n) \
((T *)arena_realloc((a), (p), (n), sizeof(T), alignof(T)))
+/* Memory allocator callbacks for memory-allocating functions */
+struct arena_ctx {
+ arena *a;
+ jmp_buf *jmp;
+};
+struct heap_ctx {
+ jmp_buf *jmp;
+};
+
[[nodiscard]] void *alloc_arena(void *, void *, size_t, size_t, size_t);
[[nodiscard]] void *alloc_heap(void *, void *, size_t, size_t, size_t);