aboutsummaryrefslogtreecommitdiff
path: root/sys/libn/memory.c
diff options
context:
space:
mode:
authorNicholas Noll <nbnoll@eml.cc>2020-06-06 12:30:48 -0700
committerNicholas Noll <nbnoll@eml.cc>2020-06-06 12:30:48 -0700
commite02e1403b432f8cd6d07ebbdd235627f20f01cfb (patch)
treee479b02d2ede4d34270889a8c2d1f627f3701e1e /sys/libn/memory.c
parenteeb5831bb4d62c35eca6db333137a9b8bf682e6e (diff)
small changes to exposure of allocation functions
Diffstat (limited to 'sys/libn/memory.c')
-rw-r--r--sys/libn/memory.c10
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.