From: Eric Wong Date: Sat, 9 Sep 2023 12:01:41 +0000 (+0000) Subject: xap_helper: use _OPENBSD_SOURCE on NetBSD for reallocarray X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=831a8eb3b396e7d5fcee65b5fd32b2b5be5df61a;p=thirdparty%2Fpublic-inbox.git xap_helper: use _OPENBSD_SOURCE on NetBSD for reallocarray 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. --- diff --git a/lib/PublicInbox/xap_helper.h b/lib/PublicInbox/xap_helper.h index 3f45e1c70..add2fe8ca 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 #include #include