libc is now made up of several independent components, each of which is individually compiled into a static library. they are then all combined into a single shared library.
45 lines
593 B
C
45 lines
593 B
C
#include <heap/heap.h>
|
|
|
|
#ifdef ENABLE_GLOBAL_HEAP
|
|
static heap_t global_heap = HEAP_INIT;
|
|
|
|
void *malloc(size_t count)
|
|
{
|
|
return heap_alloc(&global_heap, count);
|
|
}
|
|
|
|
void *calloc(size_t count, size_t size)
|
|
{
|
|
return heap_calloc(&global_heap, count, size);
|
|
}
|
|
|
|
void *realloc(void *p, size_t count)
|
|
{
|
|
return heap_realloc(&global_heap, p, count);
|
|
}
|
|
|
|
void free(void *p)
|
|
{
|
|
heap_free(&global_heap, p);
|
|
}
|
|
#else
|
|
void *malloc(size_t count)
|
|
{
|
|
return NULL;
|
|
}
|
|
|
|
void *calloc(size_t count, size_t size)
|
|
{
|
|
return NULL;
|
|
}
|
|
|
|
void *realloc(void *p, size_t count)
|
|
{
|
|
return NULL;
|
|
}
|
|
|
|
void free(void *p)
|
|
{
|
|
}
|
|
#endif
|