Skip to content

Commit 40e0507

Browse files
committed
fix build on older macOs releases, aligned_alloc only from catalina.
closes #549
1 parent ec22654 commit 40e0507

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/alloc-override.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ terms of the MIT license. A copy of the license can be found in the file
1616
#if defined(MI_MALLOC_OVERRIDE) && !(defined(_WIN32))
1717

1818
#if defined(__APPLE__)
19+
#include <AvailabilityMacros.h>
1920
mi_decl_externc void vfree(void* p);
2021
mi_decl_externc size_t malloc_size(const void* p);
2122
mi_decl_externc size_t malloc_good_size(size_t size);
@@ -77,7 +78,9 @@ typedef struct mi_nothrow_s { int _tag; } mi_nothrow_t;
7778
MI_INTERPOSE_MI(valloc),
7879
MI_INTERPOSE_MI(malloc_size),
7980
MI_INTERPOSE_MI(malloc_good_size),
81+
#if defined(MAC_OS_X_VERSION_10_15) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_15
8082
MI_INTERPOSE_MI(aligned_alloc),
83+
#endif
8184
#ifdef MI_OSX_ZONE
8285
// we interpose malloc_default_zone in alloc-override-osx.c so we can use mi_free safely
8386
MI_INTERPOSE_MI(free),

src/random.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ static bool os_random_buf(void* buf, size_t buf_len) {
195195
#elif defined(__APPLE__)
196196
#include <AvailabilityMacros.h>
197197
#if defined(MAC_OS_X_VERSION_10_10) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_10
198+
#include <CommonCrypto/CommonCryptoError.h>
198199
#include <CommonCrypto/CommonRandom.h>
199200
#endif
200201
static bool os_random_buf(void* buf, size_t buf_len) {

0 commit comments

Comments
 (0)