aboutsummaryrefslogtreecommitdiffstats
path: root/tools/lib/traceevent/event-parse.c
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung.kim@lge.com>2012-04-23 21:29:44 -0400
committerNamhyung Kim <namhyung@kernel.org>2012-07-04 00:40:31 -0400
commitf6ced60fb6c0ee115982157457c47e48802d6e1d (patch)
tree248c494d38f7c09b165bb12bcc022d4de6db8075 /tools/lib/traceevent/event-parse.c
parentc9bbabe32a231b5caa8c42fa6783405346983c59 (diff)
tools lib traceevent: Cleanup realloc use
The if branch is completely unnecessary since 'realloc' can handle NULL pointers for the first parameter. This patch is just an adoption of Ulrich Drepper's recent patch on perf tools. Signed-off-by: Namhyung Kim <namhyung.kim@lge.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ulrich Drepper <drepper@gmail.com> Link: http://lkml.kernel.org/r/1335230984-7613-1-git-send-email-namhyung.kim@lge.com Signed-off-by: Steven Rostedt <rostedt@goodmis.org> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Diffstat (limited to 'tools/lib/traceevent/event-parse.c')
-rw-r--r--tools/lib/traceevent/event-parse.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index f880db457842..5f34aa371b56 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -633,12 +633,8 @@ static void add_event(struct pevent *pevent, struct event_format *event)
633{ 633{
634 int i; 634 int i;
635 635
636 if (!pevent->events) 636 pevent->events = realloc(pevent->events, sizeof(event) *
637 pevent->events = malloc_or_die(sizeof(event)); 637 (pevent->nr_events + 1));
638 else
639 pevent->events =
640 realloc(pevent->events, sizeof(event) *
641 (pevent->nr_events + 1));
642 if (!pevent->events) 638 if (!pevent->events)
643 die("Can not allocate events"); 639 die("Can not allocate events");
644 640