aboutsummaryrefslogtreecommitdiff
path: root/include/libn.h
diff options
context:
space:
mode:
authorNicholas Noll <nbnoll@eml.cc>2021-04-22 14:08:40 -0700
committerNicholas Noll <nbnoll@eml.cc>2021-04-22 14:08:40 -0700
commit62f04ff585edd4f932f18ecad109f1d0213973a6 (patch)
tree30ac82ea314913842f9f9bdab9e289267bd2c49c /include/libn.h
parent4b0ef5bf1644520bcec05a7b2f59d6787eb616f8 (diff)
chore(refactor): libraries to define explicit interfaces
Diffstat (limited to 'include/libn.h')
-rw-r--r--include/libn.h17
1 files changed, 4 insertions, 13 deletions
diff --git a/include/libn.h b/include/libn.h
index 30b4c87..2b8dc4c 100644
--- a/include/libn.h
+++ b/include/libn.h
@@ -52,31 +52,22 @@ void* bufgrow(void*, vlong, vlong);
void _bufpop(void*, int, vlong);
// -----------------------------------------------------------------------------
-// interfaces
-// TODO(nnoll): Think about this idea
-/*
-typedef struct Iface {
- void* impl;
- byte fcn[];
-} Iface;
-*/
-// -----------------------------------------------------------------------------
// memory allocation
// TODO(nnoll): Allow for nil iterfaces?
/* allocator interface */
typedef struct mem·Allocator {
- void *(*alloc)(void *iface, uint n, ulong size);
- void (*free)(void *iface, void *ptr);
+ void *(*alloc)(void *heap, uint n, ulong size);
+ void (*free)(void *heap, void *ptr);
} mem·Allocator;
-extern mem·Allocator mem·System;
+extern mem·Allocator sys·Memory;
typedef struct mem·Reallocator {
void *(*alloc)(void *iface, uint n, ulong size);
void *(*realloc)(void *iface, void *ptr, uint n, ulong size);
void (*free)(void *iface, void *ptr);
} mem·Reallocator;
-extern mem·Reallocator mem·FullSystem;
+extern mem·Reallocator sys·Relocator;
/* simple memory arena */
typedef struct mem·Arena mem·Arena;