From a90f5ca0b675dc4cff1b920d4ea426272ce52eb7 Mon Sep 17 00:00:00 2001 From: ahmedsamyh Date: Wed, 26 Feb 2025 23:01:28 +0500 Subject: [PATCH] [commonlib.h] Make memory allocation funcs redefinable. --- commonlib.h | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/commonlib.h b/commonlib.h index 460fe4b..1604c4f 100644 --- a/commonlib.h +++ b/commonlib.h @@ -9,12 +9,6 @@ #include #include -// Memory allocation -#define C_MALLOC malloc -#define C_FREE free -#define C_REALLOC realloc -#define C_MEMCPY memcpy - // Remove Prefix #ifdef COMMONLIB_REMOVE_PREFIX #define ASSERT c_ASSERT @@ -81,6 +75,21 @@ #endif // COMMONLIB_REMOVE_PREFIX +// Memory allocation +#ifndef C_MALLOC +#define C_MALLOC malloc +#endif +#ifndef C_FREE +#define C_FREE free +#endif +#ifndef C_REALLOC +#define C_REALLOC realloc +#endif +#ifndef C_MEMCPY +#define C_MEMCPY memcpy +#endif + + // typedefs typedef unsigned int uint; typedef uint8_t uint8; -- 2.39.5