Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dæmon | fix malloc in crn_decomp single header file on macOS #7

Open
wants to merge 1 commit into
base: unity
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions inc/crn_decomp.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
#include <stdio.h>
#ifdef WIN32
#include <memory.h>
#elif defined(__APPLE__)
#include <malloc/malloc.h>
#else
#include <malloc.h>
#endif
Expand Down Expand Up @@ -1925,6 +1927,8 @@ static void* crnd_default_realloc(void* p, size_t size, size_t* pActual_size, bo
if (pActual_size) {
#ifdef WIN32
*pActual_size = p_new ? ::_msize(p_new) : 0;
#elif defined(__APPLE__)
*pActual_size = p_new ? malloc_size(p_new) : 0;
#else
*pActual_size = p_new ? malloc_usable_size(p_new) : 0;
#endif
Expand Down Expand Up @@ -1955,6 +1959,8 @@ static void* crnd_default_realloc(void* p, size_t size, size_t* pActual_size, bo
if (pActual_size) {
#ifdef WIN32
*pActual_size = ::_msize(p_final_block);
#elif defined(__APPLE__)
*pActual_size = ::malloc_size(p_final_block);
#else
*pActual_size = ::malloc_usable_size(p_final_block);
#endif
Expand All @@ -1968,6 +1974,8 @@ static size_t crnd_default_msize(void* p, void* pUser_data) {
pUser_data;
#ifdef WIN32
return p ? _msize(p) : 0;
#elif defined(__APPLE__)
return p ? malloc_size(p) : 0;
#else
return p ? malloc_usable_size(p) : 0;
#endif
Expand Down