From: Mathieu Desnoyers Date: Wed, 26 Nov 2014 17:34:56 +0000 (-0500) Subject: Cleanup: implement zmalloc as static inline X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=commitdiff_plain;h=4616a46c3c3866553a1c3e07546135e4f7ea50a3 Cleanup: implement zmalloc as static inline Whenever we can implement as static inline rather than macro, it's better (type checking of arguments, less chances of hitting preprocessor aweful semantic corner-cases....). Signed-off-by: Mathieu Desnoyers Signed-off-by: Jérémie Galarneau --- diff --git a/src/common/macros.h b/src/common/macros.h index fc159c0af..308d3d57a 100644 --- a/src/common/macros.h +++ b/src/common/macros.h @@ -46,7 +46,11 @@ /* * Memory allocation zeroed */ -#define zmalloc(x) calloc(1, x) +static inline +void *zmalloc(size_t len) +{ + return calloc(1, len); +} #ifndef ARRAY_SIZE #define ARRAY_SIZE(array) (sizeof(array) / (sizeof((array)[0])))