hollyhock
Loading...
Searching...
No Matches
Classes | Macros | Functions | Variables
mem.h File Reference

Functions used for modifying and allocating memory. More...

#include <stdint.h>
#include <stddef.h>
Include dependency graph for mem.h:

Go to the source code of this file.

Classes

struct  Mem_FreeListBlock
 

Macros

#define __UCONCAT(a, b)   #a b
 
#define _UCONCAT(a, b)   __UCONCAT(a, b)
 
#define UCONCAT(b)   _UCONCAT(__USER_LABEL_PREFIX__, b)
 

Functions

static void alloc_size (1)
 
static void assume_aligned (4)
 

Variables

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)
 

Detailed Description

Functions used for modifying and allocating memory.

Similar to the memory functions provided by the C standard library.

Variable Documentation

◆ Mem_Free

void(* Mem_Free) (void *ptr) ( void *  ptr)
extern

Frees memory allocated by Mem_Malloc, allowing it to be reused.

Parameters
ptrThe 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]destinationA pointer to the destination of the copy.
[in]sourceA pointer to the source for the copy.
numThe 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]ptrA pointer to the region of memory to fill.
valueThe value to fill the memory region with.
numThe 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
sizeThe 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
newModeThe new mode or -1 to just query.
Returns
The old mode.