summaryrefslogtreecommitdiff
path: root/src/base/allocator.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/base/allocator.h')
-rw-r--r--src/base/allocator.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/base/allocator.h b/src/base/allocator.h
new file mode 100644
index 0000000..626e294
--- /dev/null
+++ b/src/base/allocator.h
@@ -0,0 +1,23 @@
+#ifndef TINY_CONVMEM_BASE_ALLOCATOR_H
+#define TINY_CONVMEM_BASE_ALLOCATOR_H
+
+#include <stddef.h>
+
+void *tiny_alloc(size_t size);
+void *tiny_calloc(size_t count, size_t size);
+void *tiny_realloc(void *memory, size_t size);
+void tiny_free(void *memory);
+
+void tiny_allocator_reset(void);
+void tiny_allocator_fail_after(size_t allocation_index);
+size_t tiny_allocator_call_count(void);
+size_t tiny_allocator_outstanding(void);
+
+#ifndef TINY_ALLOCATOR_IMPLEMENTATION
+#define malloc tiny_alloc
+#define calloc tiny_calloc
+#define realloc tiny_realloc
+#define free tiny_free
+#endif
+
+#endif