10 #ifndef __ewf_allocator_memory_pool__h__included__
11 #define __ewf_allocator_memory_pool__h__included__
35 #ifdef EWF_PLATFORM_HAS_THREADING
36 ewf_platform_mutex* mutex_ptr;
48 #ifdef EWF_PARAMETER_CHECKING
49 #define EWF_ALLOCATOR_MEMORY_POOL_INITIALIZE_HEADER(allocator_ptr) \
51 (allocator_ptr)->struct_magic = EWF_ALLOCATOR_STRUCT_MAGIC; \
52 (allocator_ptr)->struct_size = EWF_ALLOCATOR_STRUCT_SIZE; \
53 (allocator_ptr)->struct_version = EWF_ALLOCATOR_VERSION; \
54 (allocator_ptr)->struct_type = EWF_ALLOCATOR_TYPE_MEMORY_POOL; \
57 #define EWF_ALLOCATOR_MEMORY_POOL_INITIALIZE_HEADER(allocator_ptr)
60 #ifdef EWF_PLATFORM_HAS_THREADING
61 #define EWF_ALLOCATOR_MEMORY_POOL_STATIC_DECLARE__MUTEX(mutex_ptr, name_symb) \
62 EWF_PLATFORM_MUTEX_STATIC_DECLARE(mutex_ptr, name_symb);
64 #define EWF_ALLOCATOR_MEMORY_POOL_STATIC_DECLARE__MUTEX(mutex_ptr, name_symb)
74 #define EWF_ALLOCATOR_MEMORY_POOL_STATIC_DECLARE(allocator_ptr, allocator_name_symb, block_count_param, block_size_param) \
76 static ewf_allocator_memory_pool_block ewf_allocator_memory_pool__buffer__##allocator_name_symb[ \
77 ((block_size_param > sizeof(ewf_allocator_memory_pool_block)) \
78 ? (block_size_param) : sizeof(ewf_allocator_memory_pool_block)) \
79 * (block_count_param + 1)]; \
80 static struct _ewf_allocator_memory_pool ewf_allocator_memory_pool__##allocator_name_symb = {0}; \
81 static ewf_allocator ewf_allocator__##allocator_name_symb = {0}; \
82 ewf_allocator_memory_pool__##allocator_name_symb.pool_ptr = (uint8_t*) ewf_allocator_memory_pool__buffer__##allocator_name_symb; \
83 ewf_allocator_memory_pool__##allocator_name_symb.pool_size = sizeof(ewf_allocator_memory_pool__buffer__##allocator_name_symb); \
84 ewf_allocator_memory_pool__##allocator_name_symb.block_size = (uint32_t) block_size_param; \
85 EWF_ALLOCATOR_MEMORY_POOL_STATIC_DECLARE__MUTEX(ewf_allocator_memory_pool__##allocator_name_symb.mutex_ptr, allocator_name_symb); \
86 ewf_allocator__##allocator_name_symb.block_size = block_size_param; \
87 ewf_allocator__##allocator_name_symb.block_count = block_count_param; \
88 ewf_allocator__##allocator_name_symb.start = ewf_allocator_memory_pool_start; \
89 ewf_allocator__##allocator_name_symb.stop = ewf_allocator_memory_pool_stop; \
90 ewf_allocator__##allocator_name_symb.allocate = ewf_allocator_memory_pool_allocate; \
91 ewf_allocator__##allocator_name_symb.release = ewf_allocator_memory_pool_release; \
92 ewf_allocator__##allocator_name_symb.implementation_ptr = &(ewf_allocator_memory_pool__##allocator_name_symb); \
93 allocator_ptr = &(ewf_allocator__##allocator_name_symb); \
94 EWF_ALLOCATOR_MEMORY_POOL_INITIALIZE_HEADER(allocator_ptr); \
enum _ewf_result ewf_result
Success and error result codes specific to the EWF API.
Definition: ewf_allocator_memory_pool.h:19
Definition: ewf_allocator_memory_pool.h:30
uint32_t block_size
Definition: ewf_allocator_memory_pool.h:34
uint32_t pool_size
Definition: ewf_allocator_memory_pool.h:33
The allocator structure definition.
Definition: ewf_allocator.h:27