From: Taeung Song <treeze.taeung@gmail.com>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: linux-kernel@vger.kernel.org, Jiri Olsa <jolsa@kernel.org>,
Namhyung Kim <namhyung@kernel.org>,
Ingo Molnar <mingo@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Masami Hiramatsu <mhiramat@kernel.org>,
Wang Nan <wangnan0@huawei.com>,
Taeung Song <treeze.taeung@gmail.com>,
Jiri Olsa <jolsa@redhat.com>
Subject: [PATCH v12fg 3/3] perf config: Reimplement show_config() using config_set__for_each
Date: Thu, 23 Jun 2016 23:14:32 +0900 [thread overview]
Message-ID: <1466691272-24117-4-git-send-email-treeze.taeung@gmail.com> (raw)
In-Reply-To: <1466691272-24117-1-git-send-email-treeze.taeung@gmail.com>
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..e4207a2 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;
+ perf_config_set__for_each_entry(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
next prev parent reply other threads:[~2016-06-23 14:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-23 14:14 [PATCH v12 0/3] perf config: Reimplement perf_config() Taeung Song
2016-06-23 14:14 ` [PATCH v12 1/3] perf config: Bring declarations about config from util/cache.h to util/config.h Taeung Song
2016-06-23 14:14 ` [PATCH v12 2/3] perf config: Reimplement perf_config() introducing new perf_config__init() and perf_config__finish() Taeung Song
2016-06-26 11:00 ` [tip:perf/core] perf config: Introduce new init() and exit() tip-bot for Taeung Song
2016-06-23 14:14 ` Taeung Song [this message]
2016-06-26 11:00 ` [tip:perf/core] perf config: Reimplement show_config() using config_set__for_each tip-bot for Taeung Song
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1466691272-24117-4-git-send-email-treeze.taeung@gmail.com \
--to=treeze.taeung@gmail.com \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=jolsa@kernel.org \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=wangnan0@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®