diff --git a/quickjs.c b/quickjs.c index a61bfe2..fe774fb 100644 --- a/quickjs.c +++ b/quickjs.c @@ -1388,6 +1388,12 @@ void *js_realloc_rt(JSRuntime *rt, void *ptr, size_t size) return rt->mf.js_realloc(&rt->malloc_state, ptr, size); } +static void *js_dbuf_realloc(void *opaque, void *ptr, size_t size) +{ + JSRuntime *rt = opaque; + return js_realloc_rt(rt, ptr, size); +} + size_t js_malloc_usable_size_rt(JSRuntime *rt, const void *ptr) { return rt->mf.js_malloc_usable_size(ptr); @@ -1517,7 +1523,7 @@ static inline int js_resize_array(JSContext *ctx, void **parray, int elem_size, static inline void js_dbuf_init(JSContext *ctx, DynBuf *s) { - dbuf_init2(s, ctx->rt, (DynBufReallocFunc *)js_realloc_rt); + dbuf_init2(s, ctx->rt, js_dbuf_realloc); } static inline int is_digit(int c) {