]> git.ipfire.org Git - thirdparty/libbsd.git/commitdiff
Add __arraycount() macro from NetBSD
authorGuillem Jover <guillem@hadrons.org>
Mon, 21 May 2018 01:00:47 +0000 (03:00 +0200)
committerGuillem Jover <guillem@hadrons.org>
Mon, 21 May 2018 01:36:44 +0000 (03:36 +0200)
include/bsd/sys/cdefs.h

index d1cc41920a4c968e792c63588a32393cee7fa614..98333d19b1882ee67b5676e173eb80e0eb342307 100644 (file)
 # 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 <stddef.h>, <sys/queue.h>, and <sys/types.h>
  * require it.