From b0ceb4a44cc97e7058f01d025f2a7d055b290806 Mon Sep 17 00:00:00 2001 From: daan Date: Tue, 2 Jul 2019 15:56:01 -0700 Subject: [PATCH] forward strdup, strndup, and realpath too --- src/alloc-override.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/alloc-override.c b/src/alloc-override.c index a6b2f066..3c9a19c1 100644 --- a/src/alloc-override.c +++ b/src/alloc-override.c @@ -50,10 +50,10 @@ terms of the MIT license. A copy of the license can be found in the file MI_INTERPOSE_MI(malloc), MI_INTERPOSE_MI(calloc), MI_INTERPOSE_MI(realloc), + MI_INTERPOSE_MI(free), MI_INTERPOSE_MI(strdup), MI_INTERPOSE_MI(strndup), - MI_INTERPOSE_MI(realpath), - MI_INTERPOSE_MI(free) + MI_INTERPOSE_MI(realpath) }; #else // On all other systems forward to our API @@ -61,6 +61,9 @@ terms of the MIT license. A copy of the license can be found in the file void* calloc(size_t size, size_t n) mi_attr_noexcept MI_FORWARD2(mi_calloc, size, n); void* realloc(void* p, size_t newsize) mi_attr_noexcept MI_FORWARD2(mi_realloc, p, newsize); void free(void* p) mi_attr_noexcept MI_FORWARD0(mi_free, p); + char* strdup(const char* s) MI_FORWARD1(mi_strdup, s); + char* strndup(const char* s, size_t n) MI_FORWARD2(mi_strndup, s, n); + char* realpath(const char* fname, char* resolved_name) MI_FORWARD2(mi_realpath, fname, resolved_name); #endif #if (defined(__GNUC__) || defined(__clang__)) && !defined(__MACH__) @@ -134,11 +137,6 @@ size_t malloc_size(void* p) MI_FORWARD1(mi_usable_size,p); size_t malloc_usable_size(void *p) MI_FORWARD1(mi_usable_size,p); void cfree(void* p) MI_FORWARD0(mi_free, p); -#ifdef __APPLE__ -char* strdup(const char* s) MI_FORWARD1(mi_strdup,s) -char* strndup(const char* s, size_t n) MI_FORWARD2(mi_strndup,s,n) -char* realpath(const char* fname, char* resolved_name) MI_FORWARD2(mi_realpath,fname,resolved_name) -#endif int posix_memalign(void** p, size_t alignment, size_t size) { // TODO: the spec says we should return EINVAL also if alignment is not a power of 2.