tools lib traceevent: Introduce extend_token()
authorNamhyung Kim <namhyung.kim@lge.com>
Mon, 9 Apr 2012 02:54:30 +0000 (11:54 +0900)
committerNamhyung Kim <namhyung@kernel.org>
Wed, 4 Jul 2012 04:40:31 +0000 (13:40 +0900)
commitdeba3fb26fd1ed3235b00dccced9784a7f76ec3c
tree03708b0edc3f380e316cb130d822d377032e9d69
parent0fc45ef5202a34b5862ca246740e6ab50bc3e3e1
tools lib traceevent: Introduce extend_token()

The __read_token() function has some duplicated code to handle
internal buffer overflow. Factor them out to new extend_token().

According to the man pages of realloc/free(3), they can handle NULL
pointer input so that it can be ended up to compact the code.  Also
handle error path correctly.

Signed-off-by: Namhyung Kim <namhyung.kim@lge.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@infradead.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: David Ahern <dsahern@gmail.com>
Link: http://lkml.kernel.org/r/1333940074-19052-4-git-send-email-namhyung.kim@lge.com
[rostedt@goodmis.org: added some extra whitespace]
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
tools/lib/traceevent/event-parse.c