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 /sys/libn | |
parent | eeb5831bb4d62c35eca6db333137a9b8bf682e6e (diff) |
small changes to exposure of allocation functions
Diffstat (limited to 'sys/libn')
-rw-r--r-- | sys/libn/memory.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/sys/libn/memory.c b/sys/libn/memory.c index 46f2478..31f910e 100644 --- a/sys/libn/memory.c +++ b/sys/libn/memory.c @@ -1,26 +1,36 @@ #include <u.h> #include <libn.h> +static void ·free(void* _, void* ptr) { return free(ptr); } +static void * ·alloc(void* _, uint n, ulong size) { return malloc(n*size); } +static void * ·calloc(void* _, uint n, ulong size) { return calloc(n, size); } +static void * ·realloc(void* _, void *ptr, uint n, ulong size) { return realloc(ptr, n*size); } +mem·Allocator mem·sys = { + .alloc = ·alloc, + .free = ·free +}; + + // ------------------------------------------------------------------------- // Dynamic buffer. |