* [PATCH] bpftool: replace sizeof(arr)/sizeof(arr[0]) with ARRAY_SIZE macro
@ 2022-07-26 9:30 Rongguang Wei
2022-07-27 21:03 ` Quentin Monnet
2022-07-29 17:50 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Rongguang Wei @ 2022-07-26 9:30 UTC (permalink / raw)
To: quentin, ast; +Cc: bpf, Rongguang Wei
From: Rongguang Wei <weirongguang@kylinos.cn>
Use the ARRAY_SIZE macro and make the code more compact.
Signed-off-by: Rongguang Wei <weirongguang@kylinos.cn>
---
tools/bpf/bpftool/prog.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/bpf/bpftool/prog.c b/tools/bpf/bpftool/prog.c
index 5c2c63df92e8..1e7768aa7a0e 100644
--- a/tools/bpf/bpftool/prog.c
+++ b/tools/bpf/bpftool/prog.c
@@ -1974,7 +1974,7 @@ static int profile_parse_metrics(int argc, char **argv)
int selected_cnt = 0;
unsigned int i;
- metric_cnt = sizeof(metrics) / sizeof(struct profile_metric);
+ metric_cnt = ARRAY_SIZE(metrics);
while (argc > 0) {
for (i = 0; i < metric_cnt; i++) {
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] bpftool: replace sizeof(arr)/sizeof(arr[0]) with ARRAY_SIZE macro
2022-07-26 9:30 [PATCH] bpftool: replace sizeof(arr)/sizeof(arr[0]) with ARRAY_SIZE macro Rongguang Wei
@ 2022-07-27 21:03 ` Quentin Monnet
2022-07-29 17:50 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Quentin Monnet @ 2022-07-27 21:03 UTC (permalink / raw)
To: Rongguang Wei; +Cc: Alexei Starovoitov, bpf, Rongguang Wei
On Tue, 26 Jul 2022 at 10:31, Rongguang Wei <clementwei90@163.com> wrote:
>
> From: Rongguang Wei <weirongguang@kylinos.cn>
>
> Use the ARRAY_SIZE macro and make the code more compact.
>
> Signed-off-by: Rongguang Wei <weirongguang@kylinos.cn>
Reviewed-by: Quentin Monnet <quentin@isovalent.com>
Thank you! For future patches, please specify the target tree in the
object of the message (“[PATCH bpf-next]” in this case).
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] bpftool: replace sizeof(arr)/sizeof(arr[0]) with ARRAY_SIZE macro
2022-07-26 9:30 [PATCH] bpftool: replace sizeof(arr)/sizeof(arr[0]) with ARRAY_SIZE macro Rongguang Wei
2022-07-27 21:03 ` Quentin Monnet
@ 2022-07-29 17:50 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-07-29 17:50 UTC (permalink / raw)
To: Rongguang Wei; +Cc: quentin, ast, bpf, weirongguang
Hello:
This patch was applied to bpf/bpf-next.git (master)
by Andrii Nakryiko <andrii@kernel.org>:
On Tue, 26 Jul 2022 17:30:45 +0800 you wrote:
> From: Rongguang Wei <weirongguang@kylinos.cn>
>
> Use the ARRAY_SIZE macro and make the code more compact.
>
> Signed-off-by: Rongguang Wei <weirongguang@kylinos.cn>
> ---
> tools/bpf/bpftool/prog.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Here is the summary with links:
- bpftool: replace sizeof(arr)/sizeof(arr[0]) with ARRAY_SIZE macro
https://git.kernel.org/bpf/bpf-next/c/5eff8c18f124
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-07-29 17:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-26 9:30 [PATCH] bpftool: replace sizeof(arr)/sizeof(arr[0]) with ARRAY_SIZE macro Rongguang Wei
2022-07-27 21:03 ` Quentin Monnet
2022-07-29 17:50 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).