aboutsummaryrefslogtreecommitdiff
path: root/client/memory.c
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2017-03-17 23:16:21 +0100
committertomsmeding <tom.smeding@gmail.com>2017-03-17 23:16:21 +0100
commit012f9e4156919157bfff0d5ce8f105a04b0c4a70 (patch)
treecacce5438a0e6fa8baef4ee4ef96951d7b1dd8a4 /client/memory.c
parentadd6b39aece179a0e0ad425af72b8a043a0d3188 (diff)
client: Start working on a simple client
Diffstat (limited to 'client/memory.c')
-rw-r--r--client/memory.c16
1 files changed, 16 insertions, 0 deletions
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;
+}