about summary refs log tree commit diff stats
path: root/lib/quickjs/quickjs.c
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-03-13 15:21:05 +0100
committerbptato <nincsnevem662@gmail.com>2024-03-13 15:21:05 +0100
commit9ee1dd6e5167d9c2054dee5f9241e3bba286706f (patch)
tree4c36afa6c45f33f581206583fde23ca389a04a23 /lib/quickjs/quickjs.c
parent73909b09756a3ae2c987b3ef05d02b49c4f37eaa (diff)
downloadchawan-9ee1dd6e5167d9c2054dee5f9241e3bba286706f.tar.gz
man: rewrite in Nim
Depending on Perl just for this is silly.

Now we use libregexp for filtering basically the same things as
w3mman2html did. This required another patch to QuickJS to avoid
pulling in the entire JS engine, but in return, we can now run regexes
without a dummy JS context global variable.

Also, man.nim now tries to find a man command on the system even if it's
not in /usr/bin/man.
Diffstat (limited to 'lib/quickjs/quickjs.c')
-rw-r--r--lib/quickjs/quickjs.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/quickjs/quickjs.c b/lib/quickjs/quickjs.c
index a5e51d19..9c5e948c 100644
--- a/lib/quickjs/quickjs.c
+++ b/lib/quickjs/quickjs.c
@@ -43960,16 +43960,20 @@ fail:
 
 BOOL lre_check_stack_overflow(void *opaque, size_t alloca_size)
 {
+    if (!opaque)
+        return 0;
     JSContext *ctx = opaque;
     return js_check_stack_overflow(ctx->rt, alloca_size);
 }
 
+#if 0
 void *lre_realloc(void *opaque, void *ptr, size_t size)
 {
     JSContext *ctx = opaque;
     /* No JS exception is raised here */
     return js_realloc_rt(ctx->rt, ptr, size);
 }
+#endif
 
 static JSValue js_regexp_exec(JSContext *ctx, JSValueConst this_val,
                               int argc, JSValueConst *argv)