perf tests: Use ARRAY_SIZE() were applicable
Commit-ID: be651ed98dd362fa4151f49f917c74e9e8da88ac Gitweb: http://git.kernel.org/tip/be651ed98dd362fa4151f49f917c74e9e8da88ac Author: Arnaldo Carvalho de Melo <[email protected]> AuthorDate: Fri, 18 Jan 2013 17:03:43 -0300 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Thu, 24 Jan 2013 16:40:51 -0300
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 <[email protected]>
Cc David Ahern <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Mike Galbraith <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Stephane Eranian <[email protected]>
Signed-off-by Arnaldo Carvalho de Melo <[email protected]>
--- tools/perf/tests/pmu.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
tools/perf/tests/pmu.c +2 -7
@@ -19,8 +19,6 @@ static struct test_format { { "krava23", "config2:28-29,38\n", }, }; -#define TEST_FORMATS_CNT (sizeof(test_formats) / sizeof(struct test_format)) - /* Simulated users input. */ static struct parse_events_term test_terms[] = { {
@@ -78,7 +76,6 @@ static struct parse_events_term test_terms[] = { .type_term = PARSE_EVENTS__TERM_TYPE_USER, }, }; -#define TERMS_CNT (sizeof(test_terms) / sizeof(struct parse_events_term))/* * Prepare format directory data, exported by kernel
@@ -93,7 +90,7 @@ static char *test_format_dir_get(void)if (!mkdtemp (dir))return NULL ; -for (i =0 ; i <TEST_FORMATS_CNT ; i++) { +for (i =0 ; i <ARRAY_SIZE (test_formats); i++) {static char name[PATH_MAX ];struct test_format *format = &test_formats[i];FILE *file;
@@ -130,14 +127,12 @@ static struct list_head *test_terms_list(void)static LIST_HEAD (terms);unsigned int i; -for (i =0 ; i <TERMS_CNT ; i++) +for (i =0 ; i <ARRAY_SIZE (test_terms); i++)list_add_tail (&test_terms[i].list, &terms);return &terms; } -#undef TERMS_CNT -int test__pmu (void ) {char *format =test_format_dir_get ();