summaryrefslogtreecommitdiffstats
path: root/include/xalloc.h
diff options
context:
space:
mode:
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)
{