summaryrefslogtreecommitdiff
path: root/src/util/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/util.c')
-rw-r--r--src/util/util.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/util/util.c b/src/util/util.c
index 00561b7..4f79870 100644
--- a/src/util/util.c
+++ b/src/util/util.c
@@ -62,3 +62,14 @@ size_t kai_text_to_longs(long *dest, const char *str, size_t count)
return result;
}
+
+
+void *kai_alloc(size_t size, const char *purpose)
+{
+ void *buf = malloc(size);
+ if (buf == NULL) {
+ fprintf(stderr, "[kalmia] ERROR: failed to allocated %ul-byte buffer for %s\n", size, purpose);
+ return NULL;
+ }
+ return buf;
+}