aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/mfixalloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime/mfixalloc.c')
-rw-r--r--src/runtime/mfixalloc.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/runtime/mfixalloc.c b/src/runtime/mfixalloc.c
index 904ca7e2af..dd4f3f2518 100644
--- a/src/runtime/mfixalloc.c
+++ b/src/runtime/mfixalloc.c
@@ -12,10 +12,12 @@
// Initialize f to allocate objects of the given size,
// using the allocator to obtain chunks of memory.
void
-FixAlloc_Init(FixAlloc *f, uintptr size, void *(*alloc)(uintptr))
+FixAlloc_Init(FixAlloc *f, uintptr size, void *(*alloc)(uintptr), void (*first)(void*, byte*), void *arg)
{
f->size = size;
f->alloc = alloc;
+ f->first = first;
+ f->arg = arg;
f->list = nil;
f->chunk = nil;
f->nchunk = 0;
@@ -38,6 +40,8 @@ FixAlloc_Alloc(FixAlloc *f)
f->nchunk = FixAllocChunk;
}
v = f->chunk;
+ if(f->first)
+ f->first(f->arg, v);
f->chunk += f->size;
f->nchunk -= f->size;
return v;