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