Make the quickjs embedded copy build on GNU/Hurd
authorPino Toscano <pino@debian.org>
Sun, 30 Mar 2025 06:23:58 +0000 (08:23 +0200)
committerPino Toscano <pino@debian.org>
Sun, 30 Mar 2025 06:23:58 +0000 (08:23 +0200)
Forwarded: not-needed
Origin: vendor
Last-Update: 2024-12-10

Backport/adapt the changes done in the upstream quickjs project for supporting
GNU/Hurd to the embedded copy in qbs:
https://github.com/bellard/quickjs/pull/316

This patch can be dropped when qbs rebases its copy to a new version of the
upstream quickjs.

Gbp-Pq: Name quickjs_hurd.diff

src/shared/quickjs/quickjs.c

index 3bafe694871299de462ba93f3c8499468bdbbc41..17c03baef7b14fbe884366f4998eb74f0a0abdc5 100644 (file)
@@ -36,7 +36,7 @@
 #include <math.h>
 #if defined(__APPLE__)
 #include <malloc/malloc.h>
-#elif defined(__linux__)
+#elif defined(__linux__) || defined(__GLIBC__)
 #include <malloc.h>
 #elif defined(__FreeBSD__)
 #include <malloc_np.h>
@@ -1763,7 +1763,7 @@ static size_t js_def_malloc_usable_size(const void *ptr)
     return _msize((void *)ptr);
 #elif defined(EMSCRIPTEN)
     return 0;
-#elif defined(__linux__)
+#elif defined(__linux__) || defined(__GLIBC__)
     return malloc_usable_size((void *)ptr);
 #else
     /* change this to `return 0;` if compilation fails */