From: Rongguang Wei <clementwei90@163.com>
To: quentin@isovalent.com, ast@kernel.org
Cc: bpf@vger.kernel.org, Rongguang Wei <weirongguang@kylinos.cn>
Subject: [PATCH] bpftool: replace sizeof(arr)/sizeof(arr[0]) with ARRAY_SIZE macro
Date: Tue, 26 Jul 2022 17:30:45 +0800 [thread overview]
Message-ID: <20220726093045.3374026-1-clementwei90@163.com> (raw)
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
next reply other threads:[~2022-07-26 9:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-26 9:30 Rongguang Wei [this message]
2022-07-27 21:03 ` [PATCH] bpftool: replace sizeof(arr)/sizeof(arr[0]) with ARRAY_SIZE macro Quentin Monnet
2022-07-29 17:50 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220726093045.3374026-1-clementwei90@163.com \
--to=clementwei90@163.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=quentin@isovalent.com \
--cc=weirongguang@kylinos.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).