Functions used for modifying and allocating memory.
More...
#include <stdint.h>
#include <stddef.h>
Go to the source code of this file.
|
|
#define | __UCONCAT(a, b) #a b |
| |
|
#define | _UCONCAT(a, b) __UCONCAT(a, b) |
| |
|
#define | UCONCAT(b) _UCONCAT(__USER_LABEL_PREFIX__, b) |
| |
|
|
static void | alloc_size (1) |
| |
|
static void | assume_aligned (4) |
| |
|
|
struct Mem_FreeListBlock **const | free_list_head |
| |
| void(* | Mem_Free )(void *ptr) |
| |
|
void *(* | _FP_Mem_Malloc )(size_t size) __asm__(UCONCAT("Mem_Malloc")) __attribute__((alloc_size(1) |
| |
|
void *(* | warn_unused_result ) |
| |
|
static void | unused |
| |
| void *(* | Mem_Memcpy )(void *destination, const void *source, size_t num) __attribute__((access(read_only |
| |
|
void *(* | access )(write_only, 1, 3))) |
| |
| void *(* | Mem_Memset )(void *ptr, int value, size_t num) __attribute__((access(write_only |
| |
| void *(*) void *(* | Mem_Sbrk )(long size) |
| |
| signed char(* | Mem_SbrkMode )(signed char newMode) |
| |
Functions used for modifying and allocating memory.
Similar to the memory functions provided by the C standard library.
◆ Mem_Free
| void(* Mem_Free) (void *ptr) |
( |
void * |
ptr | ) |
|
|
extern |
Frees memory allocated by Mem_Malloc, allowing it to be reused.
- Parameters
-
| ptr | The pointer to the allocated region of memory to free. |
◆ Mem_Memcpy
| void *(* Mem_Memcpy) (void *destination, const void *source, size_t num) __attribute__((access(read_only |
( |
void * |
destination, |
|
|
const void * |
source, |
|
|
size_t |
num |
|
) |
| |
|
extern |
Copies one region of memory to another. Equivalent to the C standard library function with the same name.
Copies num bytes from source to destination.
- Parameters
-
| [out] | destination | A pointer to the destination of the copy. |
| [in] | source | A pointer to the source for the copy. |
| num | The number of bytes to copy. |
- Returns
destination
◆ Mem_Memset
| void *(* Mem_Memset) (void *ptr, int value, size_t num) __attribute__((access(write_only |
( |
void * |
ptr, |
|
|
int |
value, |
|
|
size_t |
num |
|
) |
| |
|
extern |
Sets a region of memory to a specific value. Equivalent to the C standard library function with the same name.
Fills the region pointed to by ptr with num bytes of value value (zero-extended to a byte).
- Parameters
-
| [out] | ptr | A pointer to the region of memory to fill. |
| value | The value to fill the memory region with. |
| num | The number of bytes to fill. |
- Returns
ptr
◆ Mem_Sbrk
| void *(*) void *(* Mem_Sbrk) (long size) |
( |
long |
size | ) |
|
|
extern |
Changes the heap boundary by size bytes.
Be sure of what you are doing!
- Parameters
-
| size | The number of bytes to change the heap boundary. |
- Returns
- A pointer to the new heap boundary. Or -1 if OOM
◆ Mem_SbrkMode
| signed char(* Mem_SbrkMode) (signed char newMode) |
( |
signed char |
newMode | ) |
|
|
extern |
Changes what happens in a OOM situation.
If 0, display a OOM message. If 1 Mem_Sbrk returns -1.
- Parameters
-
| newMode | The new mode or -1 to just query. |
- Returns
- The old mode.