summaryrefslogtreecommitdiff
path: root/libc/include
diff options
context:
space:
mode:
authorPixel <pixel@nobis-crew.org>2011-02-05 08:35:05 -0800
committerPixel <pixel@nobis-crew.org>2011-02-05 08:35:05 -0800
commit0044f9480cfa8d5cf0a3d84e84be25e32b588726 (patch)
treebea91e4141bb77722e95885f81c545c40ed919cf /libc/include
parent0736203a630b2fbc2bc3e6383e4aec9285bba184 (diff)
Making malloc / free / realloc function pointers to be able to wrap them later for thread-safe reasons.
Diffstat (limited to 'libc/include')
-rw-r--r--libc/include/malloc.h14
1 files changed, 11 insertions, 3 deletions
diff --git a/libc/include/malloc.h b/libc/include/malloc.h
index 8dbfc05..ee877a1 100644
--- a/libc/include/malloc.h
+++ b/libc/include/malloc.h
@@ -5,9 +5,17 @@
#include <stddef.h>
#include <string.h>
-void * malloc(size_t size);
-void free(void *ptr);
-void * realloc(void *ptr, size_t size);
+typedef void * (*malloc_t)(size_t size);
+typedef void (*free_t)(void * ptr);
+typedef void * (*realloc_t)(void * ptr, size_t size);
+
+void * base_malloc(size_t size);
+void base_free(void * ptr);
+void * base_realloc(void * ptr, size_t size);
+
+extern malloc_t malloc;
+extern free_t free;
+extern realloc_t realloc;
static inline void * calloc(size_t nmemb, size_t size) {
void * r = malloc(nmemb * size);