1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-06-27 01:25:34 +00:00

[quickjs] quickjs.cpp -> quickjs.c

This commit is contained in:
Witold Filipczyk 2023-12-29 19:27:26 +01:00
parent 6ad38f3814
commit c473ce5522
3 changed files with 10 additions and 10 deletions

View File

@ -14,7 +14,7 @@ OBJS-$(CONFIG_ECMASCRIPT_SMJS) += ecmascript.obj ecmascript-c.obj localstorage-
OBJS-$(CONFIG_MUJS) += ecmascript.obj ecmascript-c.obj localstorage-db.o mujs.o timer.o
OBJS-$(CONFIG_QUICKJS) += ecmascript.obj ecmascript-c.obj localstorage-db.o quickjs.obj timer.o
OBJS-$(CONFIG_QUICKJS) += ecmascript.obj ecmascript-c.obj localstorage-db.o quickjs.o timer.o
ifeq ($(CONFIG_ECMASCRIPT_SMJS), yes)
CONFIG_ANY_SPIDERMONKEY = yes

View File

@ -22,7 +22,7 @@ if conf_data.get('CONFIG_MUJS')
endif
if conf_data.get('CONFIG_QUICKJS')
srcs += files('ecmascript.cpp', 'ecmascript-c.cpp', 'localstorage-db.c', 'quickjs.cpp', 'timer.c')
srcs += files('ecmascript.cpp', 'ecmascript-c.cpp', 'localstorage-db.c', 'quickjs.c', 'timer.c')
subdir('quickjs')
endif

View File

@ -155,7 +155,7 @@ quickjs_get_interpreter(struct ecmascript_interpreter *interpreter)
interpreter->rt = JS_NewRuntime();
#endif
if (!interpreter->rt) {
return nullptr;
return NULL;
}
JS_SetMemoryLimit(interpreter->rt, 64 * 1024 * 1024);
@ -165,7 +165,7 @@ quickjs_get_interpreter(struct ecmascript_interpreter *interpreter)
if (!ctx) {
JS_FreeRuntime(interpreter->rt);
return nullptr;
return NULL;
}
interpreter->backend_data = ctx;
@ -207,7 +207,7 @@ quickjs_put_interpreter(struct ecmascript_interpreter *interpreter)
JS_FreeContext(ctx);
JS_FreeRuntime(interpreter->rt);
interpreter->backend_data = nullptr;
interpreter->backend_data = NULL;
}
static void
@ -332,7 +332,7 @@ quickjs_call_function(struct ecmascript_interpreter *interpreter,
JSValue global_object = JS_GetGlobalObject(ctx);
REF_JS(global_object);
JSValue r = JS_Call(ctx, fun, global_object, 0, nullptr);
JSValue r = JS_Call(ctx, fun, global_object, 0, NULL);
JS_FreeValue(ctx, global_object);
done_heartbeat(interpreter->heartbeat);
@ -354,12 +354,12 @@ quickjs_eval_stringback(struct ecmascript_interpreter *interpreter,
// }
ctx = (JSContext *)interpreter->backend_data;
interpreter->heartbeat = add_heartbeat(interpreter);
interpreter->ret = nullptr;
interpreter->ret = NULL;
JSValue r = JS_Eval(ctx, code->source, code->length, "", 0);
done_heartbeat(interpreter->heartbeat);
if (JS_IsNull(r)) {
return nullptr;
return NULL;
}
if (JS_IsException(r)) {
@ -372,7 +372,7 @@ quickjs_eval_stringback(struct ecmascript_interpreter *interpreter,
str = JS_ToCStringLen(ctx, &len, r);
if (!str) {
return nullptr;
return NULL;
}
string = stracpy(str);
JS_FreeCString(ctx, str);
@ -392,7 +392,7 @@ quickjs_eval_boolback(struct ecmascript_interpreter *interpreter,
// }
ctx = (JSContext *)interpreter->backend_data;
interpreter->heartbeat = add_heartbeat(interpreter);
interpreter->ret = nullptr;
interpreter->ret = NULL;
JSValue r = JS_Eval(ctx, code->source, code->length, "", 0);
done_heartbeat(interpreter->heartbeat);