about summary refs log tree commit diff stats
path: root/lib/quickjs/quickjs.h
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-10-21 23:34:56 +0200
committerbptato <nincsnevem662@gmail.com>2023-10-21 23:40:24 +0200
commit18008acc141a55449b28c1af487a080c4bbcb355 (patch)
treea81872bfc2e2add0b0c9b6f65f3be15f4d2790c8 /lib/quickjs/quickjs.h
parent69870f3b974e65d61b564b396e01d21cc023e6e9 (diff)
downloadchawan-18008acc141a55449b28c1af487a080c4bbcb355.tar.gz
base64: reduce pointless re-coding using JSString
We now expose some functions from QuickJS to interact with JavaScript
strings without re-encoding them into UTF-8.
Diffstat (limited to 'lib/quickjs/quickjs.h')
-rw-r--r--lib/quickjs/quickjs.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/quickjs/quickjs.h b/lib/quickjs/quickjs.h
index 1d761379..c831e3c8 100644
--- a/lib/quickjs/quickjs.h
+++ b/lib/quickjs/quickjs.h
@@ -49,6 +49,7 @@ extern "C" {
 typedef struct JSRuntime JSRuntime;
 typedef struct JSContext JSContext;
 typedef struct JSObject JSObject;
+typedef struct JSString JSString;
 typedef struct JSClass JSClass;
 typedef uint32_t JSClassID;
 typedef uint32_t JSAtom;
@@ -710,6 +711,12 @@ static inline const char *JS_ToCString(JSContext *ctx, JSValueConst val1)
 }
 void JS_FreeCString(JSContext *ctx, const char *ptr);
 
+JSValue JS_NewNarrowStringLen(JSContext *ctx, const char *str, size_t len);
+JS_BOOL JS_IsStringWideChar(JSString *str);
+uint8_t *JS_GetNarrowStringBuffer(JSString *str);
+uint16_t *JS_GetWideStringBuffer(JSString *str);
+uint32_t JS_GetWideStringLength(JSString *str);
+
 JSValue JS_NewObjectProtoClass(JSContext *ctx, JSValueConst proto, JSClassID class_id);
 JSValue JS_NewObjectClass(JSContext *ctx, int class_id);
 JSValue JS_NewObjectProto(JSContext *ctx, JSValueConst proto);