Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1343258 > unrolled thread
| Started by | Taeung Song <treeze.taeung@gmail.com> |
|---|---|
| First post | 2016-02-25 16:20 +0100 |
| Last post | 2016-02-27 10:50 +0100 |
| Articles | 6 — 4 participants |
Back to article view | Back to linux.kernel
[PATCH 3/3] perf script: Remove duplicated code and needless a script_spec__findnew() Taeung Song <treeze.taeung@gmail.com> - 2016-02-25 16:20 +0100
Re: [PATCH 3/3] perf script: Remove duplicated code and needless a script_spec__findnew() Taeung Song <treeze.taeung@gmail.com> - 2016-02-25 20:10 +0100
Re: [PATCH 3/3] perf script: Remove duplicated code and needless a script_spec__findnew() Jiri Olsa <jolsa@redhat.com> - 2016-02-25 20:10 +0100
Re: [PATCH 3/3] perf script: Remove duplicated code and needless a script_spec__findnew() Taeung Song <treeze.taeung@gmail.com> - 2016-02-25 20:20 +0100
Re: [PATCH 3/3] perf script: Remove duplicated code and needless a script_spec__findnew() Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-25 20:20 +0100
[tip:perf/core] perf script: Remove duplicated code and needless script_spec__findnew() tip-bot for Taeung Song <tipbot@zytor.com> - 2016-02-27 10:50 +0100
| From | Taeung Song <treeze.taeung@gmail.com> |
|---|---|
| Date | 2016-02-25 16:20 +0100 |
| Subject | [PATCH 3/3] perf script: Remove duplicated code and needless a script_spec__findnew() |
| Message-ID | <r65RU-5J5-5@gated-at.bofh.it> |
script_spec_register() called two functions
script_spec__find() and script_spec__findnew().
But script_spec__find() was called two times.
So remove script_spec__findnew() and make
script_spec_register() only call once script_spec__find().
Cc: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Taeung Song <treeze.taeung@gmail.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;
}
--
2.5.0
[toc] | [next] | [standalone]
| From | Taeung Song <treeze.taeung@gmail.com> |
|---|---|
| Date | 2016-02-25 20:10 +0100 |
| Subject | Re: [PATCH 3/3] perf script: Remove duplicated code and needless a script_spec__findnew() |
| Message-ID | <r69su-8oR-3@gated-at.bofh.it> |
| In reply to | #1343258 |
Hi, Jiri On 02/26/2016 04:02 AM, Jiri Olsa wrote: > On Fri, Feb 26, 2016 at 12:13:10AM +0900, Taeung Song wrote: >> script_spec_register() called two functions >> script_spec__find() and script_spec__findnew(). >> But script_spec__find() was called two times. >> >> So remove script_spec__findnew() and make >> script_spec_register() only call once script_spec__find(). >> >> Cc: Jiri Olsa <jolsa@kernel.org> >> Signed-off-by: Taeung Song <treeze.taeung@gmail.com> > > Acked-by: Jiri Olsa <jolsa@kernel.org> > Thank you!! - Taeung
[toc] | [prev] | [next] | [standalone]
| From | Jiri Olsa <jolsa@redhat.com> |
|---|---|
| Date | 2016-02-25 20:10 +0100 |
| Subject | Re: [PATCH 3/3] perf script: Remove duplicated code and needless a script_spec__findnew() |
| Message-ID | <r69su-8oR-5@gated-at.bofh.it> |
| In reply to | #1343258 |
On Fri, Feb 26, 2016 at 12:13:10AM +0900, Taeung Song wrote: > script_spec_register() called two functions > script_spec__find() and script_spec__findnew(). > But script_spec__find() was called two times. > > So remove script_spec__findnew() and make > script_spec_register() only call once script_spec__find(). > > Cc: Jiri Olsa <jolsa@kernel.org> > Signed-off-by: Taeung Song <treeze.taeung@gmail.com> Acked-by: Jiri Olsa <jolsa@kernel.org> thanks, jirka
[toc] | [prev] | [next] | [standalone]
| From | Taeung Song <treeze.taeung@gmail.com> |
|---|---|
| Date | 2016-02-25 20:20 +0100 |
| Subject | Re: [PATCH 3/3] perf script: Remove duplicated code and needless a script_spec__findnew() |
| Message-ID | <r69Ca-8sB-3@gated-at.bofh.it> |
| In reply to | #1343406 |
On 02/26/2016 04:16 AM, Arnaldo Carvalho de Melo wrote: > Em Thu, Feb 25, 2016 at 08:02:22PM +0100, Jiri Olsa escreveu: >> On Fri, Feb 26, 2016 at 12:13:10AM +0900, Taeung Song wrote: >>> script_spec_register() called two functions >>> script_spec__find() and script_spec__findnew(). >>> But script_spec__find() was called two times. >>> >>> So remove script_spec__findnew() and make >>> script_spec_register() only call once script_spec__find(). >>> >>> Cc: Jiri Olsa <jolsa@kernel.org> >>> Signed-off-by: Taeung Song <treeze.taeung@gmail.com> >> >> Acked-by: Jiri Olsa <jolsa@kernel.org> > > Looks good, applied. > > Thanks, > > - Arnaldo Thank you!! Taeung
[toc] | [prev] | [next] | [standalone]
| From | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| Date | 2016-02-25 20:20 +0100 |
| Subject | Re: [PATCH 3/3] perf script: Remove duplicated code and needless a script_spec__findnew() |
| Message-ID | <r69Ca-8sB-5@gated-at.bofh.it> |
| In reply to | #1343406 |
Em Thu, Feb 25, 2016 at 08:02:22PM +0100, Jiri Olsa escreveu: > On Fri, Feb 26, 2016 at 12:13:10AM +0900, Taeung Song wrote: > > script_spec_register() called two functions > > script_spec__find() and script_spec__findnew(). > > But script_spec__find() was called two times. > > > > So remove script_spec__findnew() and make > > script_spec_register() only call once script_spec__find(). > > > > Cc: Jiri Olsa <jolsa@kernel.org> > > Signed-off-by: Taeung Song <treeze.taeung@gmail.com> > > Acked-by: Jiri Olsa <jolsa@kernel.org> Looks good, applied. Thanks, - Arnaldo
[toc] | [prev] | [next] | [standalone]
| From | tip-bot for Taeung Song <tipbot@zytor.com> |
|---|---|
| Date | 2016-02-27 10:50 +0100 |
| Subject | [tip:perf/core] perf script: Remove duplicated code and needless script_spec__findnew() |
| Message-ID | <r6JFF-XE-23@gated-at.bofh.it> |
| In reply to | #1343258 |
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;
}
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web