summaryrefslogtreecommitdiff
path: root/javascript/jsapi.h
diff options
context:
space:
mode:
Diffstat (limited to 'javascript/jsapi.h')
-rw-r--r--javascript/jsapi.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/javascript/jsapi.h b/javascript/jsapi.h
index e7c10c139..61baa5ce1 100644
--- a/javascript/jsapi.h
+++ b/javascript/jsapi.h
@@ -94,6 +94,8 @@ JS_NewCompartmentAndGlobalObject(JSContext *cx,
outchar = JS_GetStringBytes(injsstring); \
outlen = strlen(outchar)
+/* string type cast */
+#define JSAPI_STRING_TO_JSVAL(str) ((str == NULL)?JSVAL_NULL:STRING_TO_JSVAL(str))
#else /* #if JS_VERSION <= 180 */
@@ -152,6 +154,8 @@ JS_NewCompartmentAndGlobalObject(JSContext *cx,
JS_EncodeStringToBuffer(injsstring, outchar, outlen); \
outchar[outlen] = '\0'
+/* string type cast */
+#define JSAPI_STRING_TO_JSVAL(str) ((str == NULL)?JSVAL_NULL:STRING_TO_JSVAL(str))
#endif