about summary refs log tree commit homepage
path: root/lib/PublicInbox/xap_helper.h
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-09-09 12:01:41 +0000
committerEric Wong <e@80x24.org>2023-09-09 21:44:02 +0000
commit831a8eb3b396e7d5fcee65b5fd32b2b5be5df61a (patch)
tree3ecf43342465648c08bb86e86ed509679191be2f /lib/PublicInbox/xap_helper.h
parent3e37f2548f099c5e8412e1ba1e1fa850c9f8f295 (diff)
downloadpublic-inbox-831a8eb3b396e7d5fcee65b5fd32b2b5be5df61a.tar.gz
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.
Diffstat (limited to 'lib/PublicInbox/xap_helper.h')
-rw-r--r--lib/PublicInbox/xap_helper.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/PublicInbox/xap_helper.h b/lib/PublicInbox/xap_helper.h
index 3f45e1c7..add2fe8c 100644
--- a/lib/PublicInbox/xap_helper.h
+++ b/lib/PublicInbox/xap_helper.h
@@ -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>