From: Guillem Jover Date: Mon, 21 May 2018 01:00:47 +0000 (+0200) Subject: Add __arraycount() macro from NetBSD X-Git-Tag: 0.9.0~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=30b4d507540bada5533eea60a850090ccc54d397;p=thirdparty%2Flibbsd.git Add __arraycount() macro from NetBSD --- diff --git a/include/bsd/sys/cdefs.h b/include/bsd/sys/cdefs.h index d1cc419..98333d1 100644 --- a/include/bsd/sys/cdefs.h +++ b/include/bsd/sys/cdefs.h @@ -155,6 +155,12 @@ # define __bounded__(x, y, z) #endif +/* + * Return the number of elements in a statically-allocated array, + * __x. + */ +#define __arraycount(__x) (sizeof(__x) / sizeof(__x[0])) + /* * We define this here since , , and * require it.