Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1344842

[PATCH 05/19] perf script: Remove duplicated code and needless script_spec__findnew()

From Arnaldo Carvalho de Melo <acme@kernel.org>
Newsgroups linux.kernel
Subject [PATCH 05/19] perf script: Remove duplicated code and needless script_spec__findnew()
Date 2016-02-27 00:30 +0100
Message-ID <r6zZE-2as-33@gated-at.bofh.it> (permalink)
References <r6zPY-26L-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

script_spec_register() called two functions: script_spec__find() and
script_spec__findnew().  But this way script_spec__find() gets called
two times, directly and via script_spec__findnew().

So remove script_spec__findnew() and make script_spec_register() only
call once script_spec__find().

Signed-off-by: Taeung Song <treeze.taeung@gmail.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/1456413190-12378-1-git-send-email-treeze.taeung@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-script.c | 21 +++------------------
 1 file changed, 3 insertions(+), 18 deletions(-)

diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index ec4fbd410a4b..57f9a7e7f7d3 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -1212,23 +1212,6 @@ static struct script_spec *script_spec__find(const char *spec)
 	return NULL;
 }
 
-static struct script_spec *script_spec__findnew(const char *spec,
-						struct scripting_ops *ops)
-{
-	struct script_spec *s = script_spec__find(spec);
-
-	if (s)
-		return s;
-
-	s = script_spec__new(spec, ops);
-	if (!s)
-		return NULL;
-
-	script_spec__add(s);
-
-	return s;
-}
-
 int script_spec_register(const char *spec, struct scripting_ops *ops)
 {
 	struct script_spec *s;
@@ -1237,9 +1220,11 @@ int script_spec_register(const char *spec, struct scripting_ops *ops)
 	if (s)
 		return -1;
 
-	s = script_spec__findnew(spec, ops);
+	s = script_spec__new(spec, ops);
 	if (!s)
 		return -1;
+	else
+		script_spec__add(s);
 
 	return 0;
 }
-- 
2.5.0

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[GIT PULL 00/19] perf/core improvements and fixes Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-27 00:20 +0100
  [PATCH 04/19] perf script: Exception handling when the print fmt is empty Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-27 00:20 +0100
  [PATCH 13/19] perf report: Left align dynamic entries in hierarchy Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-27 00:20 +0100
  [PATCH 11/19] perf hists: Fix comparing of dynamic entries Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-27 00:20 +0100
  [PATCH 15/19] perf report: Update column width of dynamic entries Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-27 00:30 +0100
  [PATCH 10/19] perf report: Show message for percent limit on gtk Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-27 00:30 +0100
  [PATCH 06/19] perf hists: Add more helper functions for the hierarchy mode Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-27 00:30 +0100
  [PATCH 18/19] perf trace: Call bpf__apply_obj_config in 'perf trace' Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-27 00:30 +0100
  [PATCH 14/19] perf hists: Fix dynamic entry display in hierarchy Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-27 00:30 +0100
  [PATCH 03/19] perf tools: Fix parsing of pmu events with empty list of modifiers Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-27 00:30 +0100
  [PATCH 16/19] perf config: Bring perf_default_config to the very beginning at main() Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-27 00:30 +0100
  [PATCH 08/19] perf hists browser: Cleanup hist_browser__update_percent_limit() Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-27 00:30 +0100
  [PATCH 01/19] perf tools: Use asprintf() for simple string formatting/allocation Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-27 00:30 +0100
  [PATCH 02/19] perf jvmti: improve error message in Makefile Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-27 00:30 +0100
  [PATCH 19/19] perf trace: Print content of bpf-output event Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-27 00:30 +0100
  [PATCH 09/19] perf hists browser: Show message for percent limit Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-27 00:30 +0100
  [PATCH 05/19] perf script: Remove duplicated code and needless script_spec__findnew() Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-27 00:30 +0100
  [PATCH 07/19] perf report: Show message for percent limit on stdio Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-27 00:30 +0100
  Re: [GIT PULL 00/19] perf/core improvements and fixes Ingo Molnar <mingo@kernel.org> - 2016-02-27 10:40 +0100

csiph-web