about summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorFabrice Bellard <fabrice@bellard.org>2024-01-11 15:29:19 +0100
committerbptato <nincsnevem662@gmail.com>2024-01-11 18:54:13 +0100
commit091764fd976831e0b6d86f4e364dceb4e9c1114f (patch)
tree9f80769f08b6ffbdd55fdb55c47554e2afcdf381 /lib
parent3cd5c66c0c2d153c778f3d2bd5efc5d3371ad1bc (diff)
downloadchawan-091764fd976831e0b6d86f4e364dceb4e9c1114f.tar.gz
native cosmopolitan build
Diffstat (limited to 'lib')
-rw-r--r--lib/quickjs/quickjs.c21
1 files changed, 5 insertions, 16 deletions
diff --git a/lib/quickjs/quickjs.c b/lib/quickjs/quickjs.c
index e0d0e6dd..07f05822 100644
--- a/lib/quickjs/quickjs.c
+++ b/lib/quickjs/quickjs.c
@@ -1696,19 +1696,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
 }
 
@@ -1772,18 +1772,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)