Commit 30b4d507540bada5533eea60a850090ccc54d397

Guillem Jover 2018-05-21T03:00:47

Add __arraycount() macro from NetBSD

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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
@@ -156,6 +156,12 @@
 #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.
  */