From e02e1403b432f8cd6d07ebbdd235627f20f01cfb Mon Sep 17 00:00:00 2001 From: Nicholas Noll Date: Sat, 6 Jun 2020 12:30:48 -0700 Subject: small changes to exposure of allocation functions --- sys/libn/memory.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'sys/libn/memory.c') 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 #include +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. -- cgit v1.2.1