]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
perf script: Remove duplicated code and needless script_spec__findnew()
authorTaeung Song <treeze.taeung@gmail.com>
Thu, 25 Feb 2016 15:13:10 +0000 (00:13 +0900)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 25 Feb 2016 19:14:33 +0000 (16:14 -0300)
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

index ec4fbd410a4b04ccfced83dc210cfafbcb3f6948..57f9a7e7f7d3e948a29a92018140902c7f5c840f 100644 (file)
@@ -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;
 }