Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 312345
b: refs/heads/master
c: f6ced60
h: refs/heads/master
i:
  312343: 06cd84a
v: v3
  • Loading branch information
Namhyung Kim authored and Namhyung Kim committed Jul 4, 2012
1 parent 94cd42e commit 2ec1553
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 23 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c9bbabe32a231b5caa8c42fa6783405346983c59
refs/heads/master: f6ced60fb6c0ee115982157457c47e48802d6e1d
8 changes: 2 additions & 6 deletions trunk/tools/lib/traceevent/event-parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down
24 changes: 8 additions & 16 deletions trunk/tools/lib/traceevent/parse-filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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;
Expand Down

0 comments on commit 2ec1553

Please sign in to comment.