From 16c9f32f07543224080cfc6e81f26a93fdc9e5fb Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Wed, 1 Jul 2015 11:03:56 +0200 Subject: include/xalloc: add err_oom() Signed-off-by: Karel Zak --- include/xalloc.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'include/xalloc.h') diff --git a/include/xalloc.h b/include/xalloc.h index 2264eba8e..8870ac0d9 100644 --- a/include/xalloc.h +++ b/include/xalloc.h @@ -19,6 +19,13 @@ # define XALLOC_EXIT_CODE EXIT_FAILURE #endif +static inline void __err_oom(const char *file, unsigned int line) +{ + err(XALLOC_EXIT_CODE, "%s: %u: cannot allocate memory", file, line); +} + +#define err_oom() __err_oom(__FILE__, __LINE__) + static inline __ul_alloc_size(1) void *xmalloc(const size_t size) { -- cgit v1.2.3-55-g7522