forward strdup, strndup, and realpath too

This commit is contained in:
daan 2019-07-02 15:56:01 -07:00
parent b3f533167b
commit b0ceb4a44c

View File

@ -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.