1 --- src/quickjs/quickjs.c.orig 2020-06-16 16:17:17 UTC
2 +++ src/quickjs/quickjs.c
4 #include <malloc/malloc.h>
5 #elif defined(__linux__) || defined(__NX__)
7 +#elif defined(__FreeBSD__)
8 +#include <malloc_np.h>
12 @@ -1515,7 +1517,7 @@ static inline size_t js_def_malloc_usable_size(void *p
14 #elif defined(EMSCRIPTEN)
16 -#elif defined(__linux__) || defined(__NX__)
17 +#elif defined(__linux__) || defined(__NX__) || defined(__FreeBSD__)
18 return malloc_usable_size(ptr);
20 /* change this to `return 0;` if compilation fails */
21 @@ -1589,7 +1591,7 @@ static const JSMallocFunctions def_malloc_funcs = {
22 (size_t (*)(const void *))_msize,
23 #elif defined(EMSCRIPTEN)
25 -#elif defined(__linux__) || defined(__NX__)
26 +#elif defined(__linux__) || defined(__NX__) || defined(__FreeBSD__)
27 (size_t (*)(const void *))malloc_usable_size,
29 /* change this to `NULL,` if compilation fails */