diff options
author | Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> | 2014-02-06 00:32:09 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2014-02-18 07:34:50 -0500 |
commit | 5a62257a3ddd1a09cf278eae0697fcbe20897447 (patch) | |
tree | a26fefd435c259900e454c7ffc56d2db11aa568a /tools/perf/util/probe-event.c | |
parent | f49540b17c1c6fa5a0734cc1d8b57614fd2036be (diff) |
perf probe: Replace line_list with intlist
Replace line_list (struct line_node) with intlist for reducing similar
codes.
Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: "David A. Long" <dave.long@linaro.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: yrl.pp-manager.tt@hitachi.com
Link: http://lkml.kernel.org/r/20140206053209.29635.81043.stgit@kbuild-fedora.yrl.intra.hitachi.co.jp
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/probe-event.c')
-rw-r--r-- | tools/perf/util/probe-event.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index a4649e7449c5..f70fd08f00b7 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c | |||
@@ -561,7 +561,7 @@ static int _show_one_line(FILE *fp, int l, bool skip, bool show_num) | |||
561 | static int __show_line_range(struct line_range *lr, const char *module) | 561 | static int __show_line_range(struct line_range *lr, const char *module) |
562 | { | 562 | { |
563 | int l = 1; | 563 | int l = 1; |
564 | struct line_node *ln; | 564 | struct int_node *ln; |
565 | struct debuginfo *dinfo; | 565 | struct debuginfo *dinfo; |
566 | FILE *fp; | 566 | FILE *fp; |
567 | int ret; | 567 | int ret; |
@@ -614,8 +614,8 @@ static int __show_line_range(struct line_range *lr, const char *module) | |||
614 | goto end; | 614 | goto end; |
615 | } | 615 | } |
616 | 616 | ||
617 | list_for_each_entry(ln, &lr->line_list, list) { | 617 | intlist__for_each(ln, lr->line_list) { |
618 | for (; ln->line > l; l++) { | 618 | for (; ln->i > l; l++) { |
619 | ret = show_one_line(fp, l - lr->offset); | 619 | ret = show_one_line(fp, l - lr->offset); |
620 | if (ret < 0) | 620 | if (ret < 0) |
621 | goto end; | 621 | goto end; |
@@ -775,24 +775,22 @@ int show_available_vars(struct perf_probe_event *pevs __maybe_unused, | |||
775 | 775 | ||
776 | void line_range__clear(struct line_range *lr) | 776 | void line_range__clear(struct line_range *lr) |
777 | { | 777 | { |
778 | struct line_node *ln; | ||
779 | |||
780 | free(lr->function); | 778 | free(lr->function); |
781 | free(lr->file); | 779 | free(lr->file); |
782 | free(lr->path); | 780 | free(lr->path); |
783 | free(lr->comp_dir); | 781 | free(lr->comp_dir); |
784 | while (!list_empty(&lr->line_list)) { | 782 | intlist__delete(lr->line_list); |
785 | ln = list_first_entry(&lr->line_list, struct line_node, list); | ||
786 | list_del(&ln->list); | ||
787 | free(ln); | ||
788 | } | ||
789 | memset(lr, 0, sizeof(*lr)); | 783 | memset(lr, 0, sizeof(*lr)); |
790 | } | 784 | } |
791 | 785 | ||
792 | void line_range__init(struct line_range *lr) | 786 | int line_range__init(struct line_range *lr) |
793 | { | 787 | { |
794 | memset(lr, 0, sizeof(*lr)); | 788 | memset(lr, 0, sizeof(*lr)); |
795 | INIT_LIST_HEAD(&lr->line_list); | 789 | lr->line_list = intlist__new(NULL); |
790 | if (!lr->line_list) | ||
791 | return -ENOMEM; | ||
792 | else | ||
793 | return 0; | ||
796 | } | 794 | } |
797 | 795 | ||
798 | static int parse_line_num(char **ptr, int *val, const char *what) | 796 | static int parse_line_num(char **ptr, int *val, const char *what) |