Commit 5eff8c18 authored by Rongguang Wei's avatar Rongguang Wei Committed by Andrii Nakryiko

bpftool: Replace sizeof(arr)/sizeof(arr[0]) with ARRAY_SIZE macro

Use the ARRAY_SIZE macro and make the code more compact.
Signed-off-by: default avatarRongguang Wei <weirongguang@kylinos.cn>
Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
Reviewed-by: default avatarQuentin Monnet <quentin@isovalent.com>
Link: https://lore.kernel.org/bpf/20220726093045.3374026-1-clementwei90@163.com
parent 58250ae3
...@@ -1962,7 +1962,7 @@ static int profile_parse_metrics(int argc, char **argv) ...@@ -1962,7 +1962,7 @@ static int profile_parse_metrics(int argc, char **argv)
int selected_cnt = 0; int selected_cnt = 0;
unsigned int i; unsigned int i;
metric_cnt = sizeof(metrics) / sizeof(struct profile_metric); metric_cnt = ARRAY_SIZE(metrics);
while (argc > 0) { while (argc > 0) {
for (i = 0; i < metric_cnt; i++) { for (i = 0; i < metric_cnt; i++) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment