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 | 3 +++ 1 file changed, 3 insertions(+)
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>
