Skip to content

something patches for QuickJS-NG while makefile #872

@omeos

Description

@omeos

src/qjs.h

--- ./src/qjs.h	2025-03-19 13:27:18.000000000 +0800
+++ ./src/qjs.h.mod	2025-03-22 21:50:12.000000000 +0800
@@ -46,6 +46,16 @@
 #define QJS_CORE_CLASS_CRYPTO_HMAC (QJS_CORE_CLASS_ID_OFFSET + 9)
 #define QJS_CORE_CLASS_ID_LAST      (QJS_CORE_CLASS_ID_OFFSET + 10)
 
+// ["error: unknown type name 'JS_BOOL'", "error: use of undeclared identifier 'JS_BOOL'"]
+#ifndef JS_BOOL
+    #define JS_BOOL bool
+#endif
+
+// "error: too many arguments to function call, expected single argument 'val', have 2 arguments"
+// Declare a wrapper function pointer
+extern bool (*native_JS_IsArray)(JSValueConst val);
+// Replace code function pointers
+#define JS_IsArray(ctx, val) native_JS_IsArray(val)
 
 typedef JSModuleDef *(*qjs_addon_init_pt)(JSContext *ctx, const char *name);
 

src/qjs.c

--- ./src/qjs.c	2025-03-19 13:27:18.000000000 +0800
+++ ./src/qjs.c.mod	2025-03-22 21:49:45.000000000 +0800
@@ -12,6 +12,9 @@
 #include <errno.h>
 #include <signal.h>
 
+// "error: too many arguments to function call, expected single argument 'val', have 2 arguments"
+// Pointer to a native function
+bool (*native_JS_IsArray)(JSValueConst val) = JS_IsArray;
 
 typedef struct {
     njs_str_t       name;

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions