]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
xap_helper: use _OPENBSD_SOURCE on NetBSD for reallocarray
authorEric Wong <e@80x24.org>
Sat, 9 Sep 2023 12:01:41 +0000 (12:01 +0000)
committerEric Wong <e@80x24.org>
Sat, 9 Sep 2023 21:44:02 +0000 (21:44 +0000)
NetBSD prefers reallocarr(3) for predictable zero-sized
allocation behavior; but no other OS seems to have reallocarr(3).
reallocarray(3) appears in by OpenBSD, FreeBSD, glibc, and musl,
so continue to go with that.

lib/PublicInbox/xap_helper.h

index 3f45e1c7054235d3893d6cb2265e5cfb79ae71c4..add2fe8ca7d586316052a1ce0d9cf2d936d42d94 100644 (file)
@@ -14,6 +14,9 @@
 #ifndef _ALL_SOURCE
 #      define _ALL_SOURCE
 #endif
+#if defined(__NetBSD__) && !defined(_OPENBSD_SOURCE) // for reallocarray(3)
+#      define _OPENBSD_SOURCE
+#endif
 #include <sys/file.h>
 #include <sys/mman.h>
 #include <sys/resource.h>