Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions quickjs.c
Original file line number Diff line number Diff line change
Expand Up @@ -4360,6 +4360,14 @@ void JS_FreeCString(JSContext *ctx, const char *ptr)
JS_FreeValue(ctx, JS_MKPTR(JS_TAG_STRING, (JSString *)ptr - 1));
}

void JS_FreeCStringRT(JSRuntime *rt, const char *ptr)
{
if (!ptr)
return;
/* purposely removing constness */
JS_FreeValueRT(rt, JS_MKPTR(JS_TAG_STRING, (JSString *)ptr - 1));
}

static int memcmp16_8(const uint16_t *src1, const uint8_t *src2, int len)
{
int c, i;
Expand Down
1 change: 1 addition & 0 deletions quickjs.h
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,7 @@ static inline const char *JS_ToCString(JSContext *ctx, JSValueConst val1)
return JS_ToCStringLen2(ctx, NULL, val1, 0);
}
JS_EXTERN void JS_FreeCString(JSContext *ctx, const char *ptr);
JS_EXTERN void JS_FreeCStringRT(JSRuntime *rt, const char *ptr);

JS_EXTERN JSValue JS_NewObjectProtoClass(JSContext *ctx, JSValueConst proto,
JSClassID class_id);
Expand Down