diff options
Diffstat (limited to 'lib/liballoc/include/allocator.h')
| -rw-r--r-- | lib/liballoc/include/allocator.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/liballoc/include/allocator.h b/lib/liballoc/include/allocator.h new file mode 100644 index 0000000..fc9a13d --- /dev/null +++ b/lib/liballoc/include/allocator.h @@ -0,0 +1,22 @@ +#pragma once + +#include <stddef.h> + +struct allocator { + void *(*alloc)(const struct allocator *allocator, + size_t size, int *rc); + void *(*realloc)(const struct allocator *allocator, + void *p, size_t size, int *rc); + int (*free)(const struct allocator *allocator, void *p); +}; + +struct strict_allocator { + const struct allocator *allocator_ul; + struct allocator allocator; +}; + +void strict_allocator_init(struct strict_allocator *strict_allocator_init, + const struct allocator *allocator_ul); + +extern const struct allocator stdlib_heap_allocator; +extern const struct allocator stdlib_strict_heap_allocator; |
