From 2ec15534a7e2680f28aa39ad7c36b71dc03725c2 Mon Sep 17 00:00:00 2001 From: Namhyung Kim Date: Tue, 24 Apr 2012 10:29:44 +0900 Subject: [PATCH] --- yaml --- r: 312345 b: refs/heads/master c: f6ced60fb6c0ee115982157457c47e48802d6e1d h: refs/heads/master i: 312343: 06cd84a9b0b75baa8910dbe1529d88a679dce516 v: v3 --- [refs] | 2 +- trunk/tools/lib/traceevent/event-parse.c | 8 ++------ trunk/tools/lib/traceevent/parse-filter.c | 24 ++++++++--------------- 3 files changed, 11 insertions(+), 23 deletions(-) diff --git a/[refs] b/[refs] index 3f6d82590178..b345a0d2c8d1 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: c9bbabe32a231b5caa8c42fa6783405346983c59 +refs/heads/master: f6ced60fb6c0ee115982157457c47e48802d6e1d diff --git a/trunk/tools/lib/traceevent/event-parse.c b/trunk/tools/lib/traceevent/event-parse.c index f880db457842..5f34aa371b56 100644 --- a/trunk/tools/lib/traceevent/event-parse.c +++ b/trunk/tools/lib/traceevent/event-parse.c @@ -633,12 +633,8 @@ static void add_event(struct pevent *pevent, struct event_format *event) { int i; - if (!pevent->events) - pevent->events = malloc_or_die(sizeof(event)); - else - pevent->events = - realloc(pevent->events, sizeof(event) * - (pevent->nr_events + 1)); + pevent->events = realloc(pevent->events, sizeof(event) * + (pevent->nr_events + 1)); if (!pevent->events) die("Can not allocate events"); diff --git a/trunk/tools/lib/traceevent/parse-filter.c b/trunk/tools/lib/traceevent/parse-filter.c index f020ac61f9c1..ad17855528f9 100644 --- a/trunk/tools/lib/traceevent/parse-filter.c +++ b/trunk/tools/lib/traceevent/parse-filter.c @@ -148,17 +148,11 @@ add_filter_type(struct event_filter *filter, int id) if (filter_type) return filter_type; - if (!filter->filters) - filter->event_filters = - malloc_or_die(sizeof(*filter->event_filters)); - else { - filter->event_filters = - realloc(filter->event_filters, - sizeof(*filter->event_filters) * - (filter->filters + 1)); - if (!filter->event_filters) - die("Could not allocate filter"); - } + filter->event_filters = realloc(filter->event_filters, + sizeof(*filter->event_filters) * + (filter->filters + 1)); + if (!filter->event_filters) + die("Could not allocate filter"); for (i = 0; i < filter->filters; i++) { if (filter->event_filters[i].event_id > id) @@ -1480,7 +1474,7 @@ void pevent_filter_clear_trivial(struct event_filter *filter, { struct filter_type *filter_type; int count = 0; - int *ids; + int *ids = NULL; int i; if (!filter->filters) @@ -1504,10 +1498,8 @@ void pevent_filter_clear_trivial(struct event_filter *filter, default: break; } - if (count) - ids = realloc(ids, sizeof(*ids) * (count + 1)); - else - ids = malloc(sizeof(*ids)); + + ids = realloc(ids, sizeof(*ids) * (count + 1)); if (!ids) die("Can't allocate ids"); ids[count++] = filter_type->event_id;