perf script: Remove duplicated code and needless a script_spec__findnew()
PATCH 3/3 perf script: Remove duplicated code and needless a script_spec__findnew()
script_spec_register() called two functionsscript_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().
--- tools/perf/builtin-script.c | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-)
tools/perf/builtin-script.c +3 -18
@@ -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 ; }
Signature · 1 line
2.5.0
Quoted 9 lines · Taeung Song
script_spec_register()called two functionsscript_spec__find()andscript_spec__findnew().
Butscript_spec__find()was called two times.So remove
script_spec__findnew()and makescript_spec_register()only call oncescript_spec__find().Cc Jiri Olsa <[email protected]>Signed-off-by Taeung Song <[email protected]>
thanks,
jirka
Hi, Jiri
Quoted 5 lines · Jiri Olsa
Quoted 4 lines · Taeung Song
script_spec_register()called two functionsscript_spec__find()andscript_spec__findnew().
Butscript_spec__find()was called two times.
Quoted 8 lines
Quoted 5 lines
So remove
script_spec__findnew()and makescript_spec_register()only call oncescript_spec__find().Cc Jiri Olsa <[email protected]>Signed-off-by Taeung Song <[email protected]>Acked-by Jiri Olsa <[email protected]>
Thank you!!
- Taeung
Arnaldo Carvalho de Melo
maintainerEm Thu, Feb 25, 2016 at 08:02:22PM +0100, Jiri Olsa escreveu:
Quoted 5 lines · Taeung Song
Quoted 4 lines
script_spec_register()called two functionsscript_spec__find()andscript_spec__findnew().
Butscript_spec__find()was called two times.
Quoted 7 lines
Quoted 5 lines
So remove
script_spec__findnew()and makescript_spec_register()only call oncescript_spec__find().Cc Jiri Olsa <[email protected]>Signed-off-by Taeung Song <[email protected]>Acked-by Jiri Olsa <[email protected]>
Looks good, applied.
Thanks,
- Arnaldo
Quoted 12 lines · Arnaldo Carvalho de Melo
Em Thu, Feb 25, 2016 at 08:02:22PM +0100, Jiri Olsa escreveu:
Quoted 11 lines · Taeung Song
Quoted 9 lines
script_spec_register()called two functionsscript_spec__find()andscript_spec__findnew().
Butscript_spec__find()was called two times.So remove
script_spec__findnew()and makescript_spec_register()only call oncescript_spec__find().Cc Jiri Olsa <[email protected]>Signed-off-by Taeung Song <[email protected]>
Quoted 7 lines
Quoted 1 line
Acked-by Jiri Olsa <[email protected]>Looks good, applied.
Thanks,
- Arnaldo
Thank you!!
Taeung
tip-bot for Taeung Song
merge bot[tip:perf/core] perf script: Remove duplicated code and needless script_spec__findnew()
In reply to Taeung Songperf script: Remove duplicated code and needless script_spec__findnew()
Commit-ID: 8560bae02a948876b26d1d86423cf5e0bb04a815 Gitweb: http://git.kernel.org/tip/8560bae02a948876b26d1d86423cf5e0bb04a815 Author: Taeung Song <[email protected]> AuthorDate: Fri, 26 Feb 2016 00:13:10 +0900 Committer: Arnaldo Carvalho de Melo <[email protected]> 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().
--- tools/perf/builtin-script.c | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-)
tools/perf/builtin-script.c +3 -18
@@ -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 ; }