From: tip-bot for Taeung Song <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: jolsa@kernel.org, hpa@zytor.com,
alexander.shishkin@linux.intel.com, mhiramat@kernel.org,
wangnan0@huawei.com, peterz@infradead.org,
linux-kernel@vger.kernel.org, mingo@kernel.org,
treeze.taeung@gmail.com, acme@redhat.com, namhyung@kernel.org,
tglx@linutronix.de
Subject: [tip:perf/core] perf config: Reimplement show_config() using config_set__for_each
Date: Sun, 26 Jun 2016 04:00:50 -0700 [thread overview]
Message-ID: <tip-4a35b3497c413de8b409f9d75700eeb4772b21b8@git.kernel.org> (raw)
In-Reply-To: <1466691272-24117-4-git-send-email-treeze.taeung@gmail.com>
Commit-ID: 4a35b3497c413de8b409f9d75700eeb4772b21b8
Gitweb: http://git.kernel.org/tip/4a35b3497c413de8b409f9d75700eeb4772b21b8
Author: Taeung Song <treeze.taeung@gmail.com>
AuthorDate: Thu, 23 Jun 2016 23:14:32 +0900
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 23 Jun 2016 17:23:00 -0300
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>
---
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;
prev parent reply other threads:[~2016-06-26 11:01 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 ` [PATCH v12fg 3/3] perf config: Reimplement show_config() using config_set__for_each Taeung Song
2016-06-26 11:00 ` tip-bot for Taeung Song [this message]
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=tip-4a35b3497c413de8b409f9d75700eeb4772b21b8@git.kernel.org \
--to=tipbot@zytor.com \
--cc=acme@redhat.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=hpa@zytor.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=treeze.taeung@gmail.com \
--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®