From 4616a46c3c3866553a1c3e07546135e4f7ea50a3 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Wed, 26 Nov 2014 12:34:56 -0500 Subject: [PATCH] Cleanup: implement zmalloc as static inline MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- src/common/macros.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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]))) -- 2.34.1