diff options
author | Taeung Song <treeze.taeung@gmail.com> | 2016-06-23 10:14:32 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2016-06-23 16:23:00 -0400 |
commit | 4a35b3497c413de8b409f9d75700eeb4772b21b8 (patch) | |
tree | aad3076b4ccaeea4b7d9a2213282e24c36ac60d4 | |
parent | 8a0a9c7e9146781defc96f6743e7ee14ccc9ab23 (diff) |
perf config: Reimplement show_config() using config_set__for_each
Recently config_set__for_each got added. In order to let show_config()
be short and clear, rewrite this function using it.
Signed-off-by: Taeung Song <treeze.taeung@gmail.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1466691272-24117-4-git-send-email-treeze.taeung@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r-- | tools/perf/builtin-config.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/tools/perf/builtin-config.c b/tools/perf/builtin-config.c index cfd1036b1d24..e4207a23b52c 100644 --- a/tools/perf/builtin-config.c +++ b/tools/perf/builtin-config.c | |||
@@ -37,23 +37,16 @@ static int show_config(struct perf_config_set *set) | |||
37 | { | 37 | { |
38 | struct perf_config_section *section; | 38 | struct perf_config_section *section; |
39 | struct perf_config_item *item; | 39 | struct perf_config_item *item; |
40 | struct list_head *sections; | ||
41 | 40 | ||
42 | if (set == NULL) | 41 | if (set == NULL) |
43 | return -1; | 42 | return -1; |
44 | 43 | ||
45 | sections = &set->sections; | 44 | perf_config_set__for_each_entry(set, section, item) { |
46 | if (list_empty(sections)) | 45 | char *value = item->value; |
47 | return -1; | ||
48 | |||
49 | list_for_each_entry(section, sections, node) { | ||
50 | list_for_each_entry(item, §ion->items, node) { | ||
51 | char *value = item->value; | ||
52 | 46 | ||
53 | if (value) | 47 | if (value) |
54 | printf("%s.%s=%s\n", section->name, | 48 | printf("%s.%s=%s\n", section->name, |
55 | item->name, value); | 49 | item->name, value); |
56 | } | ||
57 | } | 50 | } |
58 | 51 | ||
59 | return 0; | 52 | return 0; |