diff options
author | Pino Toscano <toscano.pino@tiscali.it> | 2024-06-09 09:18:38 +0200 |
---|---|---|
committer | Charlie Gordon <github@chqrlie.org> | 2024-07-21 10:24:01 +0200 |
commit | 34894936d8ce394efa1aba7146f6cf75ad24edfe (patch) | |
tree | 023b38372126b76f6f1dd7ea1a3c41a809c1d762 /qjs.c | |
parent | 5417ab0159fc48c217ff91344a833d3286b8895d (diff) | |
download | quickjs-34894936d8ce394efa1aba7146f6cf75ad24edfe.tar.gz quickjs-34894936d8ce394efa1aba7146f6cf75ad24edfe.zip |
Use malloc_usable_size() on any OS based on GNU libc
malloc_usable_size() is a GNU extension in GNU libc; hence, use it
every time GNU libc is used, rather than only on Linux.
Diffstat (limited to 'qjs.c')
-rw-r--r-- | qjs.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -34,7 +34,7 @@ #include <time.h> #if defined(__APPLE__) #include <malloc/malloc.h> -#elif defined(__linux__) +#elif defined(__linux__) || defined(__GLIBC__) #include <malloc.h> #elif defined(__FreeBSD__) #include <malloc_np.h> @@ -151,7 +151,7 @@ static size_t js_trace_malloc_usable_size(const void *ptr) return _msize((void *)ptr); #elif defined(EMSCRIPTEN) return 0; -#elif defined(__linux__) +#elif defined(__linux__) || defined(__GLIBC__) return malloc_usable_size((void *)ptr); #else /* change this to `return 0;` if compilation fails */ |