mirror of
https://github.com/bellard/quickjs.git
synced 2025-09-30 15:04:24 +03:00
native cosmopolitan build
This commit is contained in:
21
qjs.c
21
qjs.c
@@ -140,19 +140,19 @@ static inline unsigned long long js_trace_malloc_ptr_offset(uint8_t *ptr,
|
||||
}
|
||||
|
||||
/* default memory allocation functions with memory limitation */
|
||||
static inline size_t js_trace_malloc_usable_size(void *ptr)
|
||||
static size_t js_trace_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
|
||||
}
|
||||
|
||||
@@ -264,18 +264,7 @@ static const JSMallocFunctions trace_mf = {
|
||||
js_trace_malloc,
|
||||
js_trace_free,
|
||||
js_trace_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_trace_malloc_usable_size,
|
||||
};
|
||||
|
||||
#define PROG_NAME "qjs"
|
||||
|
Reference in New Issue
Block a user