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 <pekka.paalanen@collabora.com>
This commit is contained in:
parent
c95feefbc0
commit
fc26c749df
|
@ -36,8 +36,6 @@ extern "C" {
|
|||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <libweston/zalloc.h>
|
||||
|
||||
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)))
|
||||
|
|
Loading…
Reference in New Issue