GBDK 2020 Docs API Documentation for GBDK 2020

malloc.h
Go to the documentation of this file.
1
7 #ifndef __SYS_MALLOC_H
8 #define __SYS_MALLOC_H
9
10 #include <types.h>
11
12 /* The various constants */
16 #define MALLOC_FREE 1
17 #define MALLOC_USED 2
18
21 #define MALLOC_MAGIC 123
22
23 /* malloc hunk header definition */
24 typedef struct smalloc_hunk mmalloc_hunk;
25 typedef struct smalloc_hunk * pmmalloc_hunk;
26
27 struct smalloc_hunk {
28 UBYTE magic; /* Magic number - indicates valid hunk header */
29 pmmalloc_hunk next; /* Pointer to the next hunk */
30 UWORD size; /* Size in bytes of this region */
31 int status; /* One of MALLOC_FREE or MALLOC_USED */
32 };
33
35 extern UBYTE malloc_heap_start;
36
38 extern pmmalloc_hunk malloc_first;
39
41 void malloc_gc(void) NONBANKED;
43 void debug( char *routine, char *msg ) NONBANKED;
44
45 #endif /* __SYS_MALLOC_H */
malloc_first
pmmalloc_hunk malloc_first
smalloc_hunk::next
pmmalloc_hunk next
Definition: malloc.h:29
pmmalloc_hunk
struct smalloc_hunk * pmmalloc_hunk
Definition: malloc.h:25
malloc_heap_start
UBYTE malloc_heap_start
smalloc_hunk::status
int status
Definition: malloc.h:31
UBYTE
UINT8 UBYTE
Definition: types.h:45
debug
void debug(char *routine, char *msg) NONBANKED
smalloc_hunk
Definition: malloc.h:27
malloc_gc
void malloc_gc(void) NONBANKED
NONBANKED
#define NONBANKED
Definition: types.h:11
UWORD
UINT16 UWORD
Definition: types.h:49
smalloc_hunk::size
UWORD size
Definition: malloc.h:30
smalloc_hunk::magic
UBYTE magic
Definition: malloc.h:28