X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Kernel%2Finclude%2Fheap.h;h=b058e8b41b0b3748e52fb899feb8c10c45fc5546;hb=a2495c6ea4f4cab16b5d339ae511428e92e89e73;hp=c793c874f0897225bc74adccfa807a08d7826a2e;hpb=8bc40333b1401d7616b225945fee53d972c2f418;p=tpg%2Facess2.git diff --git a/Kernel/include/heap.h b/Kernel/include/heap.h index c793c874..b058e8b4 100644 --- a/Kernel/include/heap.h +++ b/Kernel/include/heap.h @@ -1,20 +1,25 @@ -/* - * AcessOS Microkernel Version +/** + * Acess2 Kernel * heap.h + * - Dynamic Memory Allocation exports */ -#ifndef _HEAP_H -#define _HEAP_H -typedef struct { - Uint Size; - Uint Magic; - char Data[]; -} tHeapHead; +#ifndef _HEAP_H_ +#define _HEAP_H_ -typedef struct { - Uint Magic; - tHeapHead *Head; - tHeapHead NextHead[]; // Array to make it act like a pointer, but have no size -} tHeapFoot; +extern void *Heap_Allocate(const char *File, int Line, size_t Bytes); +extern void *Heap_AllocateZero(const char *File, int Line, size_t Bytes); +extern void *Heap_Reallocate(const char *File, int Line, void *Ptr, size_t Bytes); +extern void Heap_Deallocate(void *Ptr); +extern int Heap_IsHeapAddr(void *Ptr); +extern void Heap_Validate(void); + +#define malloc(size) Heap_Allocate(_MODULE_NAME_"/"__FILE__, __LINE__, (size)) +#define calloc(num,size) Heap_AllocateZero(_MODULE_NAME_"/"__FILE__, __LINE__, (num)*(size)) +#define realloc(ptr,size) Heap_Reallocate(_MODULE_NAME_"/"__FILE__, __LINE__, (ptr), (size)) +#define free(ptr) Heap_Deallocate((ptr)) +#define IsHeap(ptr) Heap_IsHeapAddr((ptr)) + +#define strdup(Str) _strdup(_MODULE_NAME_"/"__FILE__, __LINE__, (Str)) #endif