aboutsummaryrefslogtreecommitdiff
path: root/interpreter/mem.c
diff options
context:
space:
mode:
authorCamil Staps2016-08-25 20:29:50 +0200
committerCamil Staps2016-08-25 20:29:50 +0200
commit821939c6a6eb5761708146783ebd562422c2a7f7 (patch)
treedd26b29c65431801f4ca45d6952b7806534f9c8c /interpreter/mem.c
parentRemove unnecessary includes (diff)
pedantic
Diffstat (limited to 'interpreter/mem.c')
-rw-r--r--interpreter/mem.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/interpreter/mem.c b/interpreter/mem.c
new file mode 100644
index 0000000..7affd71
--- /dev/null
+++ b/interpreter/mem.c
@@ -0,0 +1,16 @@
+#include "mem.h"
+
+#include <stdio.h>
+
+void* my_calloc(size_t num, size_t size) {
+ void* ptr = calloc(num, size);
+ if (!ptr) {
+ perror(NULL);
+ exit(EXIT_FAILURE);
+ }
+ return ptr;
+}
+
+void my_free(void* ptr) {
+ free(ptr);
+}