From 625043999c19eca9c07d1d87a27e86544d1c3db7 Mon Sep 17 00:00:00 2001 From: Richard Knight Date: Sun, 19 May 2019 09:51:23 +0100 Subject: [PATCH] Allow memory allocation to be overridden --- fast_obj.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/fast_obj.h b/fast_obj.h index 99447f0..213778d 100644 --- a/fast_obj.h +++ b/fast_obj.h @@ -109,6 +109,14 @@ void fast_obj_destroy(fastObjMesh* mesh); #include #include +#ifndef FAST_OBJ_REALLOC +#define FAST_OBJ_REALLOC realloc +#endif + +#ifndef FAST_OBJ_FREE +#define FAST_OBJ_FREE free +#endif + /* Size of buffer to read into */ #define BUFFER_SIZE 65536 @@ -154,7 +162,7 @@ double POWER_10_NEG[MAX_POWER] = static void* memory_realloc(void* ptr, size_t bytes) { - return realloc(ptr, bytes); + return FAST_OBJ_REALLOC(ptr, bytes); }