All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/5] tools lib traceevent: Replace malloc_or_die to plain calloc in alloc_event()
@ 2012-06-18  2:50 Namhyung Kim
  2012-06-18  2:50 ` [PATCH v2 2/5] tools lib traceevent: Do not link broken field arg for an old ftrace event Namhyung Kim
                   ` (5 more replies)
  0 siblings, 6 replies; 13+ messages in thread
From: Namhyung Kim @ 2012-06-18  2:50 UTC (permalink / raw)
  To: Steven Rostedt, Arnaldo Carvalho de Melo
  Cc: Frederic Weisbecker, Peter Zijlstra, Ingo Molnar, LKML, Namhyung Kim

From: Namhyung Kim <namhyung.kim@lge.com>

Because the only caller of the alloc_event()
(pevent_parse_event) checks return value properly
and all it does after allocation is initializing,
it can be changed to use plain calloc.

Thanks to Steven for suggesting this simpler way.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/n/tip-wagq5qbdy1mytvjkrjbqt095@git.kernel.org
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/lib/traceevent/event-parse.c |    7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index c471075e4974..4f667fdc5fae 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -619,12 +619,7 @@ void pevent_print_printk(struct pevent *pevent)
 
 static struct event_format *alloc_event(void)
 {
-	struct event_format *event;
-
-	event = malloc_or_die(sizeof(*event));
-	memset(event, 0, sizeof(*event));
-
-	return event;
+	return calloc(1, sizeof(struct event_format));
 }
 
 static void add_event(struct pevent *pevent, struct event_format *event)
-- 
1.7.10.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2012-07-26 12:24 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-18  2:50 [PATCH v2 1/5] tools lib traceevent: Replace malloc_or_die to plain calloc in alloc_event() Namhyung Kim
2012-06-18  2:50 ` [PATCH v2 2/5] tools lib traceevent: Do not link broken field arg for an old ftrace event Namhyung Kim
2012-06-18  2:50 ` [PATCH v2 3/5] tools lib traceevent: Introduce pevent_errno Namhyung Kim
2012-06-18  2:50 ` [PATCH v2 4/5] tools lib traceevent: Introduce pevent_strerror Namhyung Kim
2012-06-18 13:41   ` Steven Rostedt
2012-06-18  2:50 ` [PATCH v2 5/5] scripts/tags.sh: Teach [ce]tags about libtraceeevent error codes Namhyung Kim
2012-06-18 13:44   ` Steven Rostedt
2012-07-26 12:24   ` Michal Marek
2012-06-18 13:37 ` [PATCH v2 1/5] tools lib traceevent: Replace malloc_or_die to plain calloc in alloc_event() Steven Rostedt
2012-06-18 13:45 ` Steven Rostedt
2012-06-18 14:06   ` Arnaldo Carvalho de Melo
2012-06-19  8:02     ` Namhyung Kim
2012-06-19 12:30       ` Steven Rostedt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.