summaryrefslogtreecommitdiffstats
path: root/include/xalloc.h
diff options
context:
space:
mode:
authorKarel Zak2015-07-01 11:03:56 +0200
committerKarel Zak2015-07-20 11:48:09 +0200
commit16c9f32f07543224080cfc6e81f26a93fdc9e5fb (patch)
tree3f5984c93e2bc0c5fc009aba299a2ecc12c401c5 /include/xalloc.h
parentlsipc: cleanup columns indexes (diff)
downloadkernel-qcow2-util-linux-16c9f32f07543224080cfc6e81f26a93fdc9e5fb.tar.gz
kernel-qcow2-util-linux-16c9f32f07543224080cfc6e81f26a93fdc9e5fb.tar.xz
kernel-qcow2-util-linux-16c9f32f07543224080cfc6e81f26a93fdc9e5fb.zip
include/xalloc: add err_oom()
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'include/xalloc.h')
-rw-r--r--include/xalloc.h7
1 files changed, 7 insertions, 0 deletions
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)
{