|
From: Masami H. <mhi...@re...> - 2010-03-16 21:57:41
|
Introducing xzalloc() which wrapping zalloc() for detecting out of memory.
Signed-off-by: Masami Hiramatsu <mhi...@re...>
Cc: Ingo Molnar <mi...@el...>
Cc: Frederic Weisbecker <fwe...@gm...>
Cc: Arnaldo Carvalho de Melo <ac...@re...>
Cc: Paul Mackerras <pa...@sa...>
Cc: Mike Galbraith <ef...@gm...>
Cc: Peter Zijlstra <a.p...@ch...>
---
tools/perf/util/util.h | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index 0f5b2a6..630902e 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -295,6 +295,13 @@ extern void *xmemdupz(const void *data, size_t len);
extern char *xstrndup(const char *str, size_t len);
extern void *xrealloc(void *ptr, size_t size) __attribute__((weak));
+static inline void *xzalloc(size_t size)
+{
+ void *buf;
+ buf = xmalloc(size);
+ return memset(buf, 0, size);
+}
+
static inline void *zalloc(size_t size)
{
return calloc(1, size);
--
Masami Hiramatsu
e-mail: mhi...@re...
|