diff options
author | Jakub Kicinski <kuba@kernel.org> | 2024-02-27 14:30:22 -0800 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2024-02-28 15:25:42 -0800 |
commit | 7600875f295f4591eebbb3744ad5de3b4f8e4117 (patch) | |
tree | bfde899f00cec63e0c742adcf63b8182324ede15 /tools/net/ynl/lib | |
parent | 0b3ece44220887e7cf1e7469867fdd8ce9986c16 (diff) |
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>
Diffstat (limited to 'tools/net/ynl/lib')
-rw-r--r-- | tools/net/ynl/lib/ynl-priv.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/tools/net/ynl/lib/ynl-priv.h b/tools/net/ynl/lib/ynl-priv.h index 1dfa09497be8..7f24d07692bf 100644 --- a/tools/net/ynl/lib/ynl-priv.h +++ b/tools/net/ynl/lib/ynl-priv.h @@ -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; |