aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2016-02-12 14:43:02 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2016-02-12 14:53:19 -0500
commitfc0a2c1d59beac70b8738f4ce14431b798837374 (patch)
treebb829db727497c244ca5eb259478a27a4c6a4b0a /tools
parenta8adfceb389a0045e06af22517fa3326797b160a (diff)
perf tools: Introduce parse_events_terms__purge()
Purges 'struct parse_event_term' entries from a list_head. Some users need this because they don't allocate space for the list head, it maybe on the stack or embedded into some other struct. Next patch will convert users that need just purging and then the perf_events__free_terms() routine will free the list head as well, finally being renamed to perf_events_terms__delete(). Acked-by: Jiri Olsa <jolsa@kernel.org> Cc: Alexei Starovoitov <ast@kernel.org> Cc: He Kuang <hekuang@huawei.com> Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Wang Nan <wangnan0@huawei.com> Cc: Zefan Li <lizefan@huawei.com> Cc: pi3orama@163.com Link: http://lkml.kernel.org/n/tip-4w3zl4ifcl0ed0j4bu3tckqp@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/util/parse-events.c7
-rw-r--r--tools/perf/util/parse-events.h1
2 files changed, 7 insertions, 1 deletions
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 133c8d28f36c..668afdccfcca 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -2068,7 +2068,7 @@ int parse_events_term__clone(struct parse_events_term **new,
2068 term->err_term, term->err_val); 2068 term->err_term, term->err_val);
2069} 2069}
2070 2070
2071void parse_events__free_terms(struct list_head *terms) 2071void parse_events_terms__purge(struct list_head *terms)
2072{ 2072{
2073 struct parse_events_term *term, *h; 2073 struct parse_events_term *term, *h;
2074 2074
@@ -2078,6 +2078,11 @@ void parse_events__free_terms(struct list_head *terms)
2078 } 2078 }
2079} 2079}
2080 2080
2081void parse_events__free_terms(struct list_head *terms)
2082{
2083 parse_events_terms__purge(terms);
2084}
2085
2081void parse_events_evlist_error(struct parse_events_evlist *data, 2086void parse_events_evlist_error(struct parse_events_evlist *data,
2082 int idx, const char *str) 2087 int idx, const char *str)
2083{ 2088{
diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h
index f1a6db107241..f90a04ccab39 100644
--- a/tools/perf/util/parse-events.h
+++ b/tools/perf/util/parse-events.h
@@ -116,6 +116,7 @@ int parse_events_term__sym_hw(struct parse_events_term **term,
116int parse_events_term__clone(struct parse_events_term **new, 116int parse_events_term__clone(struct parse_events_term **new,
117 struct parse_events_term *term); 117 struct parse_events_term *term);
118void parse_events__free_terms(struct list_head *terms); 118void parse_events__free_terms(struct list_head *terms);
119void parse_events_terms__purge(struct list_head *terms);
119int parse_events__modifier_event(struct list_head *list, char *str, bool add); 120int parse_events__modifier_event(struct list_head *list, char *str, bool add);
120int parse_events__modifier_group(struct list_head *list, char *event_mod); 121int parse_events__modifier_group(struct list_head *list, char *event_mod);
121int parse_events_name(struct list_head *list, char *name); 122int parse_events_name(struct list_head *list, char *name);