diff options
author | Nicholas Noll <nbnoll@eml.cc> | 2020-06-06 12:30:48 -0700 |
---|---|---|
committer | Nicholas Noll <nbnoll@eml.cc> | 2020-06-06 12:30:48 -0700 |
commit | e02e1403b432f8cd6d07ebbdd235627f20f01cfb (patch) | |
tree | e479b02d2ede4d34270889a8c2d1f627f3701e1e /include | |
parent | eeb5831bb4d62c35eca6db333137a9b8bf682e6e (diff) |
small changes to exposure of allocation functions
Diffstat (limited to 'include')
-rw-r--r-- | include/libn.h | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/include/libn.h b/include/libn.h index 38f0a3a..d47e7c5 100644 --- a/include/libn.h +++ b/include/libn.h @@ -59,6 +59,7 @@ typedef struct Iface { // ----------------------------------------------------------------------------- // memory allocation +// TODO(nnoll): Allow for nil iterfaces? /* allocator interface */ typedef struct mem·Allocator { void *(*alloc)(void *iface, uint n, ulong size); @@ -72,17 +73,8 @@ typedef struct mem·Reallocator { } mem·Reallocator; /* system implementation */ -extern void ·free(void* _, void *ptr); -extern void *·alloc(void* _, uint n, ulong size); -extern void *·calloc(void* _, uint n, ulong size); -extern void *·realloc(void* _, void *ptr, uint n, ulong size); - -// TODO(nnoll): Allow for nil iterfaces? -static -mem·Allocator mem·sys = { - .alloc = ·alloc, - .free = ·free -}; +extern mem·Allocator mem·sys; +extern mem·Reallocator mem·rsys; /* simple memory arena */ typedef struct mem·Arena mem·Arena; |