From 673f06c05f8c94baf5d490539c42b958f81cc37b Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 20 Jan 2022 10:25:54 +0100 Subject: [PATCH] - make m_alloc optional for tarray and memarena --- src/common/utility/memarena.cpp | 9 ++++++++- src/common/utility/tarray.h | 13 ++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/common/utility/memarena.cpp b/src/common/utility/memarena.cpp index 5439d73390..2a9467dc21 100644 --- a/src/common/utility/memarena.cpp +++ b/src/common/utility/memarena.cpp @@ -40,7 +40,14 @@ #include "basics.h" #include "memarena.h" #include "cmdlib.h" -#include "m_alloc.h" + +#if __has_include("m_alloc.h") + #include "m_alloc.h" +#else + #define M_Malloc malloc + #define M_Realloc realloc + #define M_Free free +#endif struct FMemArena::Block { diff --git a/src/common/utility/tarray.h b/src/common/utility/tarray.h index a8742a96b3..75df8dffb2 100644 --- a/src/common/utility/tarray.h +++ b/src/common/utility/tarray.h @@ -61,7 +61,13 @@ #include // for mingw #endif -#include "m_alloc.h" +#if __has_include("m_alloc.h") + #include "m_alloc.h" +#else + #define M_Malloc malloc + #define M_Realloc realloc + #define M_Free free +#endif template class TIterator { @@ -1925,3 +1931,8 @@ private: unsigned int Count; }; +#if !__has_include("m_alloc.h") + #undef M_Malloc + #undef M_Realloc + #undef M_Free +#endif