summaryrefslogtreecommitdiff
path: root/quickjs.h
diff options
context:
space:
mode:
authorFabrice Bellard <fabrice@bellard.org>2025-03-25 16:33:47 +0100
committerFabrice Bellard <fabrice@bellard.org>2025-03-25 16:33:47 +0100
commit6cc02b4421119627e56eecc9a371d7f02dc5ac1e (patch)
tree7a9bc842f49b82d7afd7174c519ee91268e633b7 /quickjs.h
parent156d981afeb07d7520ad75685e15b8dabd95f35a (diff)
downloadquickjs-6cc02b4421119627e56eecc9a371d7f02dc5ac1e.tar.gz
quickjs-6cc02b4421119627e56eecc9a371d7f02dc5ac1e.zip
more use of js_new_string8 - inlined JS_NewString() (initial patch by Charlie Gordon)
Diffstat (limited to 'quickjs.h')
-rw-r--r--quickjs.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/quickjs.h b/quickjs.h
index 849594b..4dcc0c8 100644
--- a/quickjs.h
+++ b/quickjs.h
@@ -715,7 +715,10 @@ int JS_ToBigInt64(JSContext *ctx, int64_t *pres, JSValueConst val);
int JS_ToInt64Ext(JSContext *ctx, int64_t *pres, JSValueConst val);
JSValue JS_NewStringLen(JSContext *ctx, const char *str1, size_t len1);
-JSValue JS_NewString(JSContext *ctx, const char *str);
+static inline JSValue JS_NewString(JSContext *ctx, const char *str)
+{
+ return JS_NewStringLen(ctx, str, strlen(str));
+}
JSValue JS_NewAtomString(JSContext *ctx, const char *str);
JSValue JS_ToString(JSContext *ctx, JSValueConst val);
JSValue JS_ToPropertyKey(JSContext *ctx, JSValueConst val);