Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1426410 > unrolled thread
| Started by | Taeung Song <treeze.taeung@gmail.com> |
|---|---|
| First post | 2016-06-20 11:40 +0200 |
| Last post | 2016-06-20 11:40 +0200 |
| Articles | 1 — 1 participant |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH v9 3/3] perf config: Reimplement show_config() using config_set__for_each Taeung Song <treeze.taeung@gmail.com> - 2016-06-20 11:40 +0200
| From | Taeung Song <treeze.taeung@gmail.com> |
|---|---|
| Date | 2016-06-20 11:40 +0200 |
| Subject | [PATCH v9 3/3] perf config: Reimplement show_config() using config_set__for_each |
| Message-ID | <rM3Qu-6sw-33@gated-at.bofh.it> |
Lately config_set__for_each is added.
In order to let show_config() be short and clear,
remake this function using config_set__for_each macro
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Wang Nan <wangnan0@huawei.com>
Signed-off-by: Taeung Song <treeze.taeung@gmail.com>
---
tools/perf/builtin-config.c | 17 +++++------------
1 file changed, 5 insertions(+), 12 deletions(-)
diff --git a/tools/perf/builtin-config.c b/tools/perf/builtin-config.c
index cfd1036..c144643 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)
{
struct perf_config_section *section;
struct perf_config_item *item;
- struct list_head *sections;
if (set == NULL)
return -1;
- sections = &set->sections;
- if (list_empty(sections))
- return -1;
-
- list_for_each_entry(section, sections, node) {
- list_for_each_entry(item, §ion->items, node) {
- char *value = item->value;
+ config_set__for_each(set, section, item) {
+ char *value = item->value;
- if (value)
- printf("%s.%s=%s\n", section->name,
- item->name, value);
- }
+ if (value)
+ printf("%s.%s=%s\n", section->name,
+ item->name, value);
}
return 0;
--
2.5.0
Back to top | Article view | linux.kernel
csiph-web