From: tip-bot for Namhyung Kim <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: acme@redhat.com, linux-kernel@vger.kernel.org, hpa@zytor.com,
mingo@kernel.org, namhyung.kim@lge.com, namhyung@kernel.org,
jolsa@redhat.com, fweisbec@gmail.com, rostedt@goodmis.org,
tglx@linutronix.de
Subject: [tip:perf/core] tools lib traceevent: Get rid of die() in pevent_filter_clear_trivial()
Date: Wed, 11 Dec 2013 03:06:33 -0800 [thread overview]
Message-ID: <tip-7ef2e813476273ac9c9138f002d8f4cb28e5adad@git.kernel.org> (raw)
In-Reply-To: <1386567251-22751-13-git-send-email-namhyung@kernel.org>
Commit-ID: 7ef2e813476273ac9c9138f002d8f4cb28e5adad
Gitweb: http://git.kernel.org/tip/7ef2e813476273ac9c9138f002d8f4cb28e5adad
Author: Namhyung Kim <namhyung@kernel.org>
AuthorDate: Mon, 9 Dec 2013 14:34:09 +0900
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 9 Dec 2013 15:39:57 -0300
tools lib traceevent: Get rid of die() in pevent_filter_clear_trivial()
Change the function signature to return error code and not call die()
anymore.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Reviewed-by: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1386567251-22751-13-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/lib/traceevent/event-parse.h | 2 +-
tools/lib/traceevent/parse-filter.c | 21 +++++++++++++++------
2 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/tools/lib/traceevent/event-parse.h b/tools/lib/traceevent/event-parse.h
index 620c27a..6e23f19 100644
--- a/tools/lib/traceevent/event-parse.h
+++ b/tools/lib/traceevent/event-parse.h
@@ -860,7 +860,7 @@ int pevent_event_filtered(struct event_filter *filter,
void pevent_filter_reset(struct event_filter *filter);
-void pevent_filter_clear_trivial(struct event_filter *filter,
+int pevent_filter_clear_trivial(struct event_filter *filter,
enum filter_trivial_type type);
void pevent_filter_free(struct event_filter *filter);
diff --git a/tools/lib/traceevent/parse-filter.c b/tools/lib/traceevent/parse-filter.c
index a4d5bb2..ab402fb 100644
--- a/tools/lib/traceevent/parse-filter.c
+++ b/tools/lib/traceevent/parse-filter.c
@@ -1504,8 +1504,10 @@ int pevent_update_trivial(struct event_filter *dest, struct event_filter *source
* @type: remove only true, false, or both
*
* Removes filters that only contain a TRUE or FALES boolean arg.
+ *
+ * Returns 0 on success and -1 if there was a problem.
*/
-void pevent_filter_clear_trivial(struct event_filter *filter,
+int pevent_filter_clear_trivial(struct event_filter *filter,
enum filter_trivial_type type)
{
struct filter_type *filter_type;
@@ -1514,13 +1516,15 @@ void pevent_filter_clear_trivial(struct event_filter *filter,
int i;
if (!filter->filters)
- return;
+ return 0;
/*
* Two steps, first get all ids with trivial filters.
* then remove those ids.
*/
for (i = 0; i < filter->filters; i++) {
+ int *new_ids;
+
filter_type = &filter->event_filters[i];
if (filter_type->filter->type != FILTER_ARG_BOOLEAN)
continue;
@@ -1535,19 +1539,24 @@ void pevent_filter_clear_trivial(struct event_filter *filter,
break;
}
- ids = realloc(ids, sizeof(*ids) * (count + 1));
- if (!ids)
- die("Can't allocate ids");
+ new_ids = realloc(ids, sizeof(*ids) * (count + 1));
+ if (!new_ids) {
+ free(ids);
+ return -1;
+ }
+
+ ids = new_ids;
ids[count++] = filter_type->event_id;
}
if (!count)
- return;
+ return 0;
for (i = 0; i < count; i++)
pevent_filter_remove_event(filter, ids[i]);
free(ids);
+ return 0;
}
/**
next prev parent reply other threads:[~2013-12-11 11:06 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-09 5:33 [PATCHSET 00/14] tools lib traceevent: Get rid of *die() calls from parse-filter.c Namhyung Kim
2013-12-09 5:33 ` [PATCH 01/14] tools lib traceevent: Get rid of malloc_or_die() in show_error() Namhyung Kim
2013-12-09 18:30 ` Arnaldo Carvalho de Melo
2013-12-09 19:03 ` Steven Rostedt
2013-12-09 19:14 ` Arnaldo Carvalho de Melo
2013-12-09 19:23 ` Steven Rostedt
2013-12-10 2:03 ` Namhyung Kim
2013-12-10 2:14 ` Steven Rostedt
2013-12-10 5:01 ` Namhyung Kim
2013-12-10 5:30 ` Namhyung Kim
2013-12-11 0:40 ` Namhyung Kim
2013-12-11 1:55 ` Steven Rostedt
2013-12-11 2:29 ` Namhyung Kim
2013-12-12 1:10 ` Steven Rostedt
2013-12-09 5:33 ` [PATCH 02/14] tools lib traceevent: Get rid of die in add_filter_type() Namhyung Kim
2013-12-09 10:44 ` Jiri Olsa
2013-12-10 0:32 ` Namhyung Kim
2013-12-09 5:34 ` [PATCH 03/14] tools lib traceevent: Get rid of malloc_or_die() in pevent_filter_alloc() Namhyung Kim
2013-12-11 11:05 ` [tip:perf/core] " tip-bot for Namhyung Kim
2013-12-09 5:34 ` [PATCH 04/14] tools lib traceevent: Get rid of malloc_or_die() allocate_arg() Namhyung Kim
2013-12-09 16:05 ` Steven Rostedt
2013-12-10 1:21 ` Namhyung Kim
2013-12-10 2:08 ` Steven Rostedt
2013-12-09 5:34 ` [PATCH 05/14] tools lib traceevent: Get rid of malloc_or_die() in read_token() Namhyung Kim
2013-12-09 5:34 ` [PATCH 06/14] tools lib traceevent: Get rid of malloc_or_die() in find_event() Namhyung Kim
2013-12-09 11:03 ` Jiri Olsa
2013-12-09 16:27 ` Steven Rostedt
2013-12-10 0:48 ` Namhyung Kim
2013-12-09 5:34 ` [PATCH 07/14] tools lib traceevent: Get rid of malloc_or_die() in add_event() Namhyung Kim
2013-12-11 11:06 ` [tip:perf/core] " tip-bot for Namhyung Kim
2013-12-09 5:34 ` [PATCH 08/14] tools lib traceevent: Get rid of die() in create_arg_item() Namhyung Kim
2013-12-11 11:06 ` [tip:perf/core] " tip-bot for Namhyung Kim
2013-12-09 5:34 ` [PATCH 09/14] tools lib traceevent: Get rid of die() in add_right() Namhyung Kim
2013-12-09 6:28 ` Ilia Mirkin
2013-12-09 6:59 ` Namhyung Kim
2013-12-09 16:32 ` Steven Rostedt
2013-12-09 23:47 ` Namhyung Kim
2013-12-09 5:34 ` [PATCH 10/14] tools lib traceevent: Get rid of die() in reparent_op_arg() Namhyung Kim
2013-12-09 5:34 ` [PATCH 11/14] tools lib traceevent: Get rid of malloc_or_die() in pevent_filter_add_filter_str() Namhyung Kim
2013-12-11 11:06 ` [tip:perf/core] " tip-bot for Namhyung Kim
2013-12-09 5:34 ` [PATCH 12/14] tools lib traceevent: Get rid of die() in pevent_filter_clear_trivial() Namhyung Kim
2013-12-11 11:06 ` tip-bot for Namhyung Kim [this message]
2013-12-09 5:34 ` [PATCH 13/14] tools lib traceevent: Refactor test_filter() to get rid of die() Namhyung Kim
2013-12-09 16:19 ` Steven Rostedt
2013-12-10 1:48 ` Namhyung Kim
2013-12-09 5:34 ` [PATCH 14/14] tools lib traceevent: Get rid of die() in some string conversion funcitons Namhyung Kim
2013-12-09 16:24 ` Steven Rostedt
2013-12-10 1:50 ` Namhyung Kim
2013-12-09 10:47 ` [PATCHSET 00/14] tools lib traceevent: Get rid of *die() calls from parse-filter.c Jiri Olsa
2013-12-09 16:40 ` Steven Rostedt
2013-12-09 16:24 ` Steven Rostedt
2013-12-09 18:41 ` Arnaldo Carvalho de Melo
2013-12-10 0:34 ` Namhyung Kim
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-7ef2e813476273ac9c9138f002d8f4cb28e5adad@git.kernel.org \
--to=tipbot@zytor.com \
--cc=acme@redhat.com \
--cc=fweisbec@gmail.com \
--cc=hpa@zytor.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung.kim@lge.com \
--cc=namhyung@kernel.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox