Kernel - Slight reworks to timer code
[tpg/acess2.git] / Kernel / include / heap.h
index 1b883eb..b058e8b 100644 (file)
@@ -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 an element, but have no size and refer to the next block
-} 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

UCC git Repository :: git.ucc.asn.au