diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-01-18 15:03:43 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-01-24 14:40:51 -0500 |
commit | be651ed98dd362fa4151f49f917c74e9e8da88ac (patch) | |
tree | 38cef5d0eb439ad87e4d28cc495d856d0fea7f68 /tools | |
parent | 23b6339b914ec009ba206584a410039b589243aa (diff) |
perf tests: Use ARRAY_SIZE() were applicable
We were using a homebrew equivalent, use the macro that is used
everywhere for this function.
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-bp3wokafua1ecairau77jcy0@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/tests/pmu.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/tools/perf/tests/pmu.c b/tools/perf/tests/pmu.c index 6803ed1a06dd..12b322fa3475 100644 --- a/tools/perf/tests/pmu.c +++ b/tools/perf/tests/pmu.c | |||
@@ -19,8 +19,6 @@ static struct test_format { | |||
19 | { "krava23", "config2:28-29,38\n", }, | 19 | { "krava23", "config2:28-29,38\n", }, |
20 | }; | 20 | }; |
21 | 21 | ||
22 | #define TEST_FORMATS_CNT (sizeof(test_formats) / sizeof(struct test_format)) | ||
23 | |||
24 | /* Simulated users input. */ | 22 | /* Simulated users input. */ |
25 | static struct parse_events_term test_terms[] = { | 23 | static struct parse_events_term test_terms[] = { |
26 | { | 24 | { |
@@ -78,7 +76,6 @@ static struct parse_events_term test_terms[] = { | |||
78 | .type_term = PARSE_EVENTS__TERM_TYPE_USER, | 76 | .type_term = PARSE_EVENTS__TERM_TYPE_USER, |
79 | }, | 77 | }, |
80 | }; | 78 | }; |
81 | #define TERMS_CNT (sizeof(test_terms) / sizeof(struct parse_events_term)) | ||
82 | 79 | ||
83 | /* | 80 | /* |
84 | * Prepare format directory data, exported by kernel | 81 | * Prepare format directory data, exported by kernel |
@@ -93,7 +90,7 @@ static char *test_format_dir_get(void) | |||
93 | if (!mkdtemp(dir)) | 90 | if (!mkdtemp(dir)) |
94 | return NULL; | 91 | return NULL; |
95 | 92 | ||
96 | for (i = 0; i < TEST_FORMATS_CNT; i++) { | 93 | for (i = 0; i < ARRAY_SIZE(test_formats); i++) { |
97 | static char name[PATH_MAX]; | 94 | static char name[PATH_MAX]; |
98 | struct test_format *format = &test_formats[i]; | 95 | struct test_format *format = &test_formats[i]; |
99 | FILE *file; | 96 | FILE *file; |
@@ -130,14 +127,12 @@ static struct list_head *test_terms_list(void) | |||
130 | static LIST_HEAD(terms); | 127 | static LIST_HEAD(terms); |
131 | unsigned int i; | 128 | unsigned int i; |
132 | 129 | ||
133 | for (i = 0; i < TERMS_CNT; i++) | 130 | for (i = 0; i < ARRAY_SIZE(test_terms); i++) |
134 | list_add_tail(&test_terms[i].list, &terms); | 131 | list_add_tail(&test_terms[i].list, &terms); |
135 | 132 | ||
136 | return &terms; | 133 | return &terms; |
137 | } | 134 | } |
138 | 135 | ||
139 | #undef TERMS_CNT | ||
140 | |||
141 | int test__pmu(void) | 136 | int test__pmu(void) |
142 | { | 137 | { |
143 | char *format = test_format_dir_get(); | 138 | char *format = test_format_dir_get(); |