From 012f9e4156919157bfff0d5ce8f105a04b0c4a70 Mon Sep 17 00:00:00 2001 From: tomsmeding Date: Fri, 17 Mar 2017 23:16:21 +0100 Subject: client: Start working on a simple client --- client/memory.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 client/memory.c (limited to 'client/memory.c') diff --git a/client/memory.c b/client/memory.c new file mode 100644 index 0000000..aec3da2 --- /dev/null +++ b/client/memory.c @@ -0,0 +1,16 @@ +#include "global.h" +#include "memory.h" + +void* check_after_allocation(const char *func,size_t num,size_t sz,void *ptr){ + if(ptr==NULL){ + die("Allocation failed: %s(%zu * %zuB = %zu)",func,num,sz,num*sz); + } + return ptr; +} + +void* check_after_allocation_str(const char *func,void *ptr){ + if(ptr==NULL){ + die("Allocation failed: %s()",func); + } + return ptr; +} -- cgit v1.2.3-54-g00ecf