From: tip-bot for Taeung Song <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: acme@redhat.com, jolsa@kernel.org, mingo@kernel.org,
linux-kernel@vger.kernel.org, hpa@zytor.com, tglx@linutronix.de,
treeze.taeung@gmail.com, namhyung@kernel.org
Subject: [tip:perf/core] perf script: Remove duplicated code and needless script_spec__findnew()
Date: Sat, 27 Feb 2016 01:41:00 -0800 [thread overview]
Message-ID: <tip-8560bae02a948876b26d1d86423cf5e0bb04a815@git.kernel.org> (raw)
In-Reply-To: <1456413190-12378-1-git-send-email-treeze.taeung@gmail.com>
Commit-ID: 8560bae02a948876b26d1d86423cf5e0bb04a815
Gitweb: http://git.kernel.org/tip/8560bae02a948876b26d1d86423cf5e0bb04a815
Author: Taeung Song <treeze.taeung@gmail.com>
AuthorDate: Fri, 26 Feb 2016 00:13:10 +0900
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 25 Feb 2016 16:14:33 -0300
perf script: Remove duplicated code and needless script_spec__findnew()
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 ec4fbd4..57f9a7e 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;
}
prev parent reply other threads:[~2016-02-27 9:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-25 15:13 [PATCH 3/3] perf script: Remove duplicated code and needless a script_spec__findnew() Taeung Song
2016-02-25 19:02 ` Jiri Olsa
2016-02-25 19:06 ` Taeung Song
2016-02-25 19:16 ` Arnaldo Carvalho de Melo
2016-02-25 19:17 ` Taeung Song
2016-02-27 9:41 ` 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-8560bae02a948876b26d1d86423cf5e0bb04a815@git.kernel.org \
--to=tipbot@zytor.com \
--cc=acme@redhat.com \
--cc=hpa@zytor.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=tglx@linutronix.de \
--cc=treeze.taeung@gmail.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