tools: ynl: create local ARRAY_SIZE() helper

libc doesn't have an ARRAY_SIZE() create one locally.

Acked-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Link: https://lore.kernel.org/r/20240227223032.1835527-6-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Jakub Kicinski
2024-02-27 14:30:22 -08:00
parent 0b3ece4422
commit 7600875f29
2 changed files with 5 additions and 2 deletions

View File

@@ -27,6 +27,9 @@ enum ynl_policy_type {
YNL_PT_BITFIELD32,
};
#define YNL_ARRAY_SIZE(array) (sizeof(array) ? \
sizeof(array) / sizeof(array[0]) : 0)
struct ynl_policy_attr {
enum ynl_policy_type type;
unsigned int len;