From fc26c749dfae47e5b4f81ad38760e3e7585b3216 Mon Sep 17 00:00:00 2001 From: Pekka Paalanen Date: Wed, 20 Jul 2022 12:47:11 +0300 Subject: [PATCH] shared/xalloc.h: do not rely on zalloc() The definition of zalloc is trivial, so let's just have it here instead of loading libweston/zalloc.h. Now xalloc.h does not depend on any libweston header, which makes me feel slightly better. It's more clean. Who knows, maybe one day libweston/zalloc.h will be removed. Signed-off-by: Pekka Paalanen --- shared/xalloc.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/shared/xalloc.h b/shared/xalloc.h index f73c2315..2bbb426e 100644 --- a/shared/xalloc.h +++ b/shared/xalloc.h @@ -36,8 +36,6 @@ extern "C" { #include #include -#include - static inline void * abort_oom_if_null(void *p) { @@ -54,7 +52,7 @@ abort_oom_if_null(void *p) } #define xmalloc(s) (abort_oom_if_null(malloc(s))) -#define xzalloc(s) (abort_oom_if_null(zalloc(s))) +#define xzalloc(s) (abort_oom_if_null(calloc(1, s))) #define xcalloc(n, s) (abort_oom_if_null(calloc(n, s))) #define xstrdup(s) (abort_oom_if_null(strdup(s))) #define xrealloc(p, s) (abort_oom_if_null(realloc(p, s)))