diff options
author | Nicholas Noll <nbnoll@eml.cc> | 2021-12-05 11:55:10 -0800 |
---|---|---|
committer | Nicholas Noll <nbnoll@eml.cc> | 2021-12-05 12:02:10 -0800 |
commit | c200dd832789afa298ba45e0b9efdec96c0e92cc (patch) | |
tree | 4dc5622468a23acfd747e7778eeb9132266d7c9b /src/base/fmt | |
parent | 8eedf5bdb05c2df0cd339f8742dc4f1752e8aaae (diff) |
Chore: simplified allocator interfaces.
I was never happy with the allocator/reallocator split.
It was originally designed to accomodate things like arenas that don't
free. But the majority of the time you don't care about this.
Diffstat (limited to 'src/base/fmt')
-rw-r--r-- | src/base/fmt/buffer.c | 6 | ||||
-rw-r--r-- | src/base/fmt/open.c | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/base/fmt/buffer.c b/src/base/fmt/buffer.c index 0099e72..e039577 100644 --- a/src/base/fmt/buffer.c +++ b/src/base/fmt/buffer.c @@ -7,7 +7,7 @@ flush(fmt·State *io) char *s; void *heap = io->heap; - mem·Reallocator mem = io->mem; + mem·Allocator mem = io->mem; if(!io->buffer.beg) return 0; @@ -29,7 +29,7 @@ flush(fmt·State *io) } int -fmt·make(mem·Reallocator mem, void *heap, fmt·State *io) +fmt·make(mem·Allocator mem, void *heap, fmt·State *io) { int n; @@ -53,7 +53,7 @@ void fmt·free(fmt·State *io) { void *heap = io->heap; - mem·Reallocator mem = io->mem; + mem·Allocator mem = io->mem; mem.free(heap, io->buffer.beg); io->buffer.beg = io->buffer.cur = io->buffer.end = nil; diff --git a/src/base/fmt/open.c b/src/base/fmt/open.c index b6829bb..2020a2a 100644 --- a/src/base/fmt/open.c +++ b/src/base/fmt/open.c @@ -27,7 +27,7 @@ fmt·open(int fd, int len, char *buf, fmt·State *io) io->n = 0; /* no heap needed */ io->heap = nil; - io->mem = (mem·Reallocator){ 0 }; + io->mem = (mem·Allocator){ 0 }; fmt·setlocale(io, nil, nil, nil); |