#include "allocator.h" /* Dispatches the alloc call */ void *mem_alloc(MemAllocator *self, usize n) { if (self->alloc) return self->alloc(self, n); return nil; } /* Dispatches the realloc call */ void *mem_realloc(MemAllocator *self, void *ptr, usize n) { if (self->realloc) return self->realloc(self, ptr, n); return nil; } /* Dispatches the free call */ void mem_free(MemAllocator *self, void *ptr) { if (self->free) self->free(self, ptr); }