quickjs-tart

quickjs-based runtime for wallet-core logic
Log | Files | Refs | README | LICENSE

commit f375c8fab8ae2dd6ecd9ebf4a720b65d85df9962
parent 8cc4f99aa7e7ec15aedbe01a42d266f1c3c68347
Author: Pino Toscano <toscano.pino@tiscali.it>
Date:   Sun,  9 Jun 2024 09:18:38 +0200

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:
Mquickjs/qjs.c | 4++--
Mquickjs/quickjs.c | 4++--
2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/quickjs/qjs.c b/quickjs/qjs.c @@ -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 */ diff --git a/quickjs/quickjs.c b/quickjs/quickjs.c @@ -34,7 +34,7 @@ #include <math.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> @@ -1712,7 +1712,7 @@ static size_t js_def_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 */