summaryrefslogtreecommitdiff
path: root/quickjs.c
diff options
context:
space:
mode:
authorFabrice Bellard <fabrice@bellard.org>2024-01-11 15:29:19 +0100
committerFabrice Bellard <fabrice@bellard.org>2024-01-11 15:29:19 +0100
commit9a4379daf69b68b3196613be11c0ef4e19203ef3 (patch)
treecd257da9b41de8d4ef8d3b0c21b671c2c9da50d3 /quickjs.c
parente80917bad46fd000406416518cb63da9bc6f29e6 (diff)
downloadquickjs-9a4379daf69b68b3196613be11c0ef4e19203ef3.tar.gz
quickjs-9a4379daf69b68b3196613be11c0ef4e19203ef3.zip
native cosmopolitan build
Diffstat (limited to 'quickjs.c')
-rw-r--r--quickjs.c21
1 files changed, 5 insertions, 16 deletions
diff --git a/quickjs.c b/quickjs.c
index 37201fc..ce035ec 100644
--- a/quickjs.c
+++ b/quickjs.c
@@ -1692,19 +1692,19 @@ void JS_SetRuntimeOpaque(JSRuntime *rt, void *opaque)
}
/* default memory allocation functions with memory limitation */
-static inline size_t js_def_malloc_usable_size(void *ptr)
+static size_t js_def_malloc_usable_size(const void *ptr)
{
#if defined(__APPLE__)
return malloc_size(ptr);
#elif defined(_WIN32)
- return _msize(ptr);
+ return _msize((void *)ptr);
#elif defined(EMSCRIPTEN)
return 0;
#elif defined(__linux__)
- return malloc_usable_size(ptr);
+ return malloc_usable_size((void *)ptr);
#else
/* change this to `return 0;` if compilation fails */
- return malloc_usable_size(ptr);
+ return malloc_usable_size((void *)ptr);
#endif
}
@@ -1768,18 +1768,7 @@ static const JSMallocFunctions def_malloc_funcs = {
js_def_malloc,
js_def_free,
js_def_realloc,
-#if defined(__APPLE__)
- malloc_size,
-#elif defined(_WIN32)
- (size_t (*)(const void *))_msize,
-#elif defined(EMSCRIPTEN)
- NULL,
-#elif defined(__linux__)
- (size_t (*)(const void *))malloc_usable_size,
-#else
- /* change this to `NULL,` if compilation fails */
- malloc_usable_size,
-#endif
+ js_def_malloc_usable_size,
};
JSRuntime *JS_NewRuntime(void)