perf tools: Introduce parse_events_terms__purge()
authorArnaldo Carvalho de Melo <acme@redhat.com>
Fri, 12 Feb 2016 19:43:02 +0000 (16:43 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Fri, 12 Feb 2016 19:53:19 +0000 (16:53 -0300)
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>
tools/perf/util/parse-events.c
tools/perf/util/parse-events.h

index 133c8d28f36c7961045098a28bdc4b2bae40e135..668afdccfccaff5f33011b24a44f2d82b5dcef59 100644 (file)
@@ -2068,7 +2068,7 @@ int parse_events_term__clone(struct parse_events_term **new,
                        term->err_term, term->err_val);
 }
 
-void parse_events__free_terms(struct list_head *terms)
+void parse_events_terms__purge(struct list_head *terms)
 {
        struct parse_events_term *term, *h;
 
@@ -2078,6 +2078,11 @@ void parse_events__free_terms(struct list_head *terms)
        }
 }
 
+void parse_events__free_terms(struct list_head *terms)
+{
+       parse_events_terms__purge(terms);
+}
+
 void parse_events_evlist_error(struct parse_events_evlist *data,
                               int idx, const char *str)
 {
index f1a6db107241b1c8ffaf03a3514ba1549df6fd1b..f90a04ccab394814170157fae5ac8caea5813dd6 100644 (file)
@@ -116,6 +116,7 @@ int parse_events_term__sym_hw(struct parse_events_term **term,
 int parse_events_term__clone(struct parse_events_term **new,
                             struct parse_events_term *term);
 void parse_events__free_terms(struct list_head *terms);
+void parse_events_terms__purge(struct list_head *terms);
 int parse_events__modifier_event(struct list_head *list, char *str, bool add);
 int parse_events__modifier_group(struct list_head *list, char *event_mod);
 int parse_events_name(struct list_head *list, char *name);
This page took 0.041172 seconds and 5 git commands to generate.