X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Kernel%2Fheap.c;h=a8fdd536580fad117bd86ff684cf9d9ea5decfc9;hb=38e4b28d370c5f9284b285a71518ae2b6bce125c;hp=79f5f40402908688fbd87061286dccc9264dee34;hpb=2c9822ab13554ffab9f634a839ee916e0388179c;p=tpg%2Facess2.git diff --git a/Kernel/heap.c b/Kernel/heap.c index 79f5f404..a8fdd536 100644 --- a/Kernel/heap.c +++ b/Kernel/heap.c @@ -280,7 +280,7 @@ void free(void *Ptr) return; } if(foot->Magic != MAGIC_FOOT) { - Warning("free - Footer magic is invalid (%p, 0x%x)\n", head, foot->Magic); + Warning("free - Footer magic is invalid (%p, %p = 0x%x)\n", head, &foot->Magic, foot->Magic); return; } @@ -368,6 +368,22 @@ void *realloc(void *__ptr, size_t __size) return NULL; } +/** + * \fn void *calloc(size_t num, size_t size) + * \brief Allocate and Zero a buffer in memory + * \param num Number of elements + * \param size Size of each element + */ +void *calloc(size_t num, size_t size) +{ + void *ret = malloc(num*size); + if(ret == NULL) return NULL; + + memset( ret, 0, num*size ); + + return ret; +} + /** * \fn int IsHeap(void *Ptr) * \brief Checks if an address is a heap address @@ -428,3 +444,8 @@ void Heap_Dump() } } #endif + +// === EXPORTS === +EXPORT(malloc); +EXPORT(realloc); +EXPORT(free);