From 30b4d507540bada5533eea60a850090ccc54d397 Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Mon, 21 May 2018 03:00:47 +0200 Subject: [PATCH] Add __arraycount() macro from NetBSD --- include/bsd/sys/cdefs.h | 6 ++++++ 1 file changed, 6 insertions(+) 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.