Cleanup: implement zmalloc as static inline
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 26 Nov 2014 17:34:56 +0000 (12:34 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 26 Nov 2014 20:57:22 +0000 (15:57 -0500)
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 <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/common/macros.h

index fc159c0af3c707102d7bb853a49360d16e01c1d1..308d3d57a14d5ff9ad7911383af9f40f0477c4da 100644 (file)
 /*
  * 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])))
This page took 0.026501 seconds and 5 git commands to generate.