malloc/calloc/free and minimal allocator testing
[lugburz] / src / amiga / libc / malloc.c
1 #include <stdlib.h>
2 #include <string.h>
3 #include "mem.h"
4
5 void *malloc(size_t sz)
6 {
7         return mem_alloc(sz, 0);
8 }
9
10 void *calloc(size_t n, size_t sz)
11 {
12         void *p = mem_alloc(n * sz, 0);
13         if(!p) return 0;
14         memset(p, 0, n * sz);
15         return p;
16 }
17
18 void free(void *p)
19 {
20         mem_free(p);
21 }