write the allocators layer

This commit is contained in:
Gregory Wells
2025-08-09 20:04:34 -04:00
parent 88ce5153e4
commit af7d75b728
4 changed files with 73 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
#pragma once
#include <stdlib.h>
typedef void* (*PFN_gnMalloc) (size_t size, void* userData);
typedef void* (*PFN_gnCalloc) (int cnt, size_t size, void* userData);
typedef void* (*PFN_gnRealloc) (void* ptr, size_t size, void* userData);
typedef void (*PFN_gnFree) (void* ptr, void* userData);
typedef struct gnAllocators {
void* userData;
PFN_gnMalloc malloc;
PFN_gnCalloc calloc;
PFN_gnRealloc realloc;
PFN_gnFree free;
} gnAllocators;
#define gnMalloc(allocators, size) allocators->malloc(size, allocators->userData)