diff options
author | Eric Andersen <andersen@codepoet.org> | 2000-10-09 20:06:30 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2000-10-09 20:06:30 +0000 |
commit | c1fe19d4c1db610692365472a90f4661e48449c1 (patch) | |
tree | d0b0219ffca3c4c4256f55c4aea4513e43d6aecd /libc/stdlib/malloc/alloc.c | |
parent | 9efafb8bbc7408b04643dcd53825d971577b4d9d (diff) |
Bug ugly formatting update
Diffstat (limited to 'libc/stdlib/malloc/alloc.c')
-rw-r--r-- | libc/stdlib/malloc/alloc.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/libc/stdlib/malloc/alloc.c b/libc/stdlib/malloc/alloc.c new file mode 100644 index 000000000..b782f6dcf --- /dev/null +++ b/libc/stdlib/malloc/alloc.c @@ -0,0 +1,48 @@ +#include <unistd.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <sys/mman.h> + + +#ifdef L_calloc_dbg + +void * +calloc_dbg(size_t num, size_t size, char * function, char * file, int line) +{ + void * ptr; + fprintf(stderr, "calloc of %d bytes at %s @%s:%d = ", num*size, function, file, line); + ptr = calloc(num,size); + fprintf(stderr, "%p\n", ptr); + return ptr; +} + +#endif + +#ifdef L_malloc_dbg + +void * +malloc_dbg(size_t len, char * function, char * file, int line) +{ + void * result; + fprintf(stderr, "malloc of %d bytes at %s @%s:%d = ", len, function, file, line); + result = malloc(len); + fprintf(stderr, "%p\n", result); + return result; +} + +#endif + +#ifdef L_free_dbg + +void +free_dbg(void * ptr, char * function, char * file, int line) +{ + fprintf(stderr, "free of %p at %s @%s:%d\n", ptr, function, file, line); + free(ptr); +} + +#endif + + |