summaryrefslogtreecommitdiff
path: root/scripts/include/array_size.h
diff options
context:
space:
mode:
authorMasahiro Yamada <masahiroy@kernel.org>2024-07-20 16:27:38 +0900
committerMasahiro Yamada <masahiroy@kernel.org>2024-07-21 23:10:43 +0900
commitfbaf242c956aff6a07d9e97eaa3a0a48d947de33 (patch)
tree9c2870d0112b16bde9cba2c2bc189b5b412dd45d /scripts/include/array_size.h
parent6e6ef2da3a28f3e02fd204b4f8821030b61f8cd4 (diff)
kbuild: move some helper headers from scripts/kconfig/ to scripts/include/
Move array_size.h, hashtable.h, list.h, list_types.h from scripts/kconfig/ to scripts/include/. These headers will be useful for other host programs. Remove scripts/mod/list.h. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Diffstat (limited to 'scripts/include/array_size.h')
-rw-r--r--scripts/include/array_size.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/scripts/include/array_size.h b/scripts/include/array_size.h
new file mode 100644
index 000000000000..26ba78d867d1
--- /dev/null
+++ b/scripts/include/array_size.h
@@ -0,0 +1,11 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef ARRAY_SIZE_H
+#define ARRAY_SIZE_H
+
+/**
+ * ARRAY_SIZE - get the number of elements in array @arr
+ * @arr: array to be sized
+ */
+#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+
+#endif /* ARRAY_SIZE_H */