aboutsummaryrefslogtreecommitdiff
path: root/include/libn.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/libn.h')
-rw-r--r--include/libn.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/libn.h b/include/libn.h
index 64e2e70..74e230e 100644
--- a/include/libn.h
+++ b/include/libn.h
@@ -48,6 +48,18 @@ void* bufgrow(void*, vlong, vlong);
void _bufpop(void*, int, vlong);
// -----------------------------------------------------------------------------
+// Memory allocation
+
+// TODO: Think about interface here.
+typedef struct Allocator {
+ void *(*alloc)(ulong size);
+ void *(*realloc)(void *ptr, ulong size);
+ void (*free)(void *ptr);
+} Allocator;
+
+static Allocator mem·sys = { .alloc = &malloc, .realloc = &realloc, .free = &free};
+
+// -----------------------------------------------------------------------------
// Co-routines
typedef struct Coro Coro;