From 2f2965992b1725f9a6c852c278be0f6f93050d27 Mon Sep 17 00:00:00 2001 From: Rich Geldreich Date: Wed, 10 Mar 2021 03:21:33 -0500 Subject: [PATCH] Was always including malloc.h - this is now only done on Linux. It was for malloc_usable_size(). --- transcoder/basisu_containers.h | 5 +++++ transcoder/basisu_containers_impl.h | 12 ++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/transcoder/basisu_containers.h b/transcoder/basisu_containers.h index a42bde9..9a31766 100644 --- a/transcoder/basisu_containers.h +++ b/transcoder/basisu_containers.h @@ -5,7 +5,12 @@ #include #include #include + +#ifdef __linux__ +// Only for malloc_usable_size() in basisu_containers_impl.h #include +#define HAS_MALLOC_USABLE_SIZE 1 +#endif #ifdef _MSC_VER #define BASISU_FORCE_INLINE __forceinline diff --git a/transcoder/basisu_containers_impl.h b/transcoder/basisu_containers_impl.h index 1a0d7cb..6555171 100644 --- a/transcoder/basisu_containers_impl.h +++ b/transcoder/basisu_containers_impl.h @@ -57,10 +57,10 @@ namespace basisu #ifdef _MSC_VER actual_size = _msize(new_p); -//#elif defined(__EMSCRIPTEN__) -// actual_size = desired_size; -#else +#elif HAS_MALLOC_USABLE_SIZE actual_size = malloc_usable_size(new_p); +#else + actual_size = desired_size; #endif m_p = new_p; } @@ -84,10 +84,10 @@ namespace basisu #ifdef _MSC_VER actual_size = _msize(new_p); -//#elif defined(__EMSCRIPTEN__) -// actual_size = desired_size; -#else +#elif HAS_MALLOC_USABLE_SIZE actual_size = malloc_usable_size(new_p); +#else + actual_size = desired_size; #endif (*pMover)(new_p, m_p, m_size);