Embedded Wireless Framework
Data Structures | Macros | Typedefs | Functions
The C heap allocator

The C heap allocator. More...

Data Structures

struct  _ewf_allocator_c_heap
 C heap allocator implementation type. More...
 

Macros

#define EWF_ALLOCATOR_C_HEAP_INITIALIZE_HEADER(allocator_ptr)
 
#define EWF_ALLOCATOR_C_HEAP_STATIC_DECLARE(allocator_ptr, allocator_name_symb, block_count_param, block_size_param)
 Declare a C heap allocator. More...
 

Typedefs

typedef struct _ewf_allocator_c_heap ewf_allocator_c_heap
 C heap allocator implementation type.
 

Functions

ewf_result ewf_allocator_c_heap_start (ewf_allocator *allocator_ptr)
 
ewf_result ewf_allocator_c_heap_stop (ewf_allocator *allocator_ptr)
 
ewf_result ewf_allocator_c_heap_allocate (ewf_allocator *allocator_ptr, void **p)
 
ewf_result ewf_allocator_c_heap_release (ewf_allocator *allocator_ptr, void *p)
 

Detailed Description

The C heap allocator.

Macro Definition Documentation

◆ EWF_ALLOCATOR_C_HEAP_STATIC_DECLARE

#define EWF_ALLOCATOR_C_HEAP_STATIC_DECLARE (   allocator_ptr,
  allocator_name_symb,
  block_count_param,
  block_size_param 
)
Value:
do { \
static ewf_allocator_c_heap ewf_allocator_c_heap__##allocator_name_symb = {0}; \
static ewf_allocator ewf_allocator__##allocator_name_symb = {0}; \
ewf_allocator_c_heap__##allocator_name_symb.block_count = block_count_param; \
ewf_allocator_c_heap__##allocator_name_symb.block_size = block_size_param; \
ewf_allocator__##allocator_name_symb.start = ewf_allocator_c_heap_start; \
ewf_allocator__##allocator_name_symb.stop = ewf_allocator_c_heap_stop; \
ewf_allocator__##allocator_name_symb.allocate = ewf_allocator_c_heap_allocate; \
ewf_allocator__##allocator_name_symb.release = ewf_allocator_c_heap_release; \
ewf_allocator__##allocator_name_symb.implementation_ptr = &(ewf_allocator_c_heap__##allocator_name_symb); \
allocator_ptr = &(ewf_allocator__##allocator_name_symb); \
EWF_ALLOCATOR_C_HEAP_INITIALIZE_HEADER(allocator_ptr); \
} while(0)
C heap allocator implementation type.
Definition: ewf_allocator_c_heap.h:31
The allocator structure definition.
Definition: ewf_allocator.h:27

Declare a C heap allocator.

Parameters
[in,out]allocator_ptra pointer to an allocator that will be initialized to point to the one statically declared by the macro
[in]allocator_name_symba unique symbol name that will be used as a name suffix for the statically declared data
[in]block_countthe number of blocks
[in]block_sizethe size of each block