linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org,
	Taeung Song <treeze.taeung@gmail.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Wang Nan <wangnan0@huawei.com>,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 27/27] perf config: Reimplement show_config() using config_set__for_each
Date: Thu, 23 Jun 2016 18:24:14 -0300	[thread overview]
Message-ID: <1466717054-31048-28-git-send-email-acme@kernel.org> (raw)
In-Reply-To: <1466717054-31048-1-git-send-email-acme@kernel.org>

From: Taeung Song <treeze.taeung@gmail.com>

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 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)
 {
 	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, &section->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.5

  parent reply	other threads:[~2016-06-23 21:24 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-23 21:23 [GIT PULL 00/27] perf/core improvements and fixes Arnaldo Carvalho de Melo
2016-06-23 21:23 ` [PATCH 01/27] perf script stackcollapse: Remove reference to the perl interpreter Arnaldo Carvalho de Melo
2016-06-23 21:23 ` [PATCH 02/27] perf hists browser: Move hist_browser into header file Arnaldo Carvalho de Melo
2016-06-23 21:23 ` [PATCH 03/27] perf hists browser: Make (new|delete|run) public Arnaldo Carvalho de Melo
2016-06-23 21:23 ` [PATCH 04/27] perf hists browser: Introduce struct hist_browser title callback Arnaldo Carvalho de Melo
2016-06-23 21:23 ` [PATCH 05/27] perf hists browser: Move horizontal scroll init to new() Arnaldo Carvalho de Melo
2016-06-23 21:23 ` [PATCH 06/27] perf hists browser: Introduce perf_evsel_browser constructor Arnaldo Carvalho de Melo
2016-06-23 21:23 ` [PATCH 07/27] perf hists browser: Introduce init() Arnaldo Carvalho de Melo
2016-06-23 21:23 ` [PATCH 08/27] perf hists: Enlarge pid sort entry size Arnaldo Carvalho de Melo
2016-06-23 21:23 ` [PATCH 09/27] perf evlist: Destructors should accept NULL Arnaldo Carvalho de Melo
2016-06-23 21:23 ` [PATCH 10/27] perf session: " Arnaldo Carvalho de Melo
2016-06-23 21:23 ` [PATCH 11/27] perf tests time-to-tsc: No need to disable an event before deleting it Arnaldo Carvalho de Melo
2016-06-23 21:23 ` [PATCH 12/27] perf machine: Destructors should accept NULL Arnaldo Carvalho de Melo
2016-06-23 21:24 ` [PATCH 13/27] perf tools: Let python use correct gcc for build_ext Arnaldo Carvalho de Melo
2016-06-23 21:24 ` [PATCH 14/27] perf config: Move config declarations from util/cache.h to util/config.h Arnaldo Carvalho de Melo
2016-06-23 21:24 ` [PATCH 15/27] perf tools: Find right DSO taking into account if binary is 32 or 64-bit Arnaldo Carvalho de Melo
2016-06-23 21:24 ` [PATCH 16/27] perf unwind: Change macro names of perf register Arnaldo Carvalho de Melo
2016-06-23 21:24 ` [PATCH 17/27] perf unwind: Fix wrongly used regs for x86_32 unwind Arnaldo Carvalho de Melo
2016-06-23 21:24 ` [PATCH 18/27] perf unwind: Fix wrongly used regs for aarch64 unwind Arnaldo Carvalho de Melo
2016-06-23 21:24 ` [PATCH 19/27] perf evlist: Rename for_each() macros to for_each_entry() Arnaldo Carvalho de Melo
2016-06-23 21:24 ` [PATCH 20/27] perf tools: Rename strlist_for_each() " Arnaldo Carvalho de Melo
2016-06-23 21:24 ` [PATCH 21/27] perf rb_resort: Rename for_each() " Arnaldo Carvalho de Melo
2016-06-23 21:24 ` [PATCH 22/27] perf intlist: " Arnaldo Carvalho de Melo
2016-06-23 21:24 ` [PATCH 23/27] perf script: Print sample flags more nicely Arnaldo Carvalho de Melo
2016-06-23 21:24 ` [PATCH 24/27] perf auxtrace: Add option to feed branches to the thread stack Arnaldo Carvalho de Melo
2016-06-23 21:24 ` [PATCH 25/27] perf script: Add callindent option Arnaldo Carvalho de Melo
2016-06-23 21:24 ` [PATCH 26/27] perf config: Introduce new init() and exit() Arnaldo Carvalho de Melo
2016-06-23 21:24 ` Arnaldo Carvalho de Melo [this message]
2016-06-26 10:43 ` [GIT PULL 00/27] perf/core improvements and fixes Ingo Molnar

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=1466717054-31048-28-git-send-email-acme@kernel.org \
    --to=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --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;
as well as URLs for NNTP newsgroup(s).