10 #ifndef __ewf_allocator__h__included__
11 #define __ewf_allocator__h__included__
28 #ifdef EWF_PARAMETER_CHECKING
29 uint32_t struct_magic;
31 uint32_t struct_version;
43 void* implementation_ptr;
46 #define EWF_ALLOCATOR_STRUCT_MAGIC (0xA110CA70)
47 #define EWF_ALLOCATOR_STRUCT_SIZE (sizeof(struct _ewf_allocator))
48 #define EWF_ALLOCATOR_VERSION (EWF_DEVELOPER_MICROSOFT | 0x0001)
50 #ifdef EWF_PARAMETER_CHECKING
51 #define EWF_ALLOCATOR_VALIDATE_POINTER(allocator_ptr) \
53 if ((allocator_ptr == NULL) || \
54 (allocator_ptr->struct_magic != EWF_ALLOCATOR_STRUCT_MAGIC) || \
55 (allocator_ptr->struct_size != EWF_ALLOCATOR_STRUCT_SIZE) || \
56 (allocator_ptr->struct_version != EWF_ALLOCATOR_VERSION) || \
57 (allocator_ptr->implementation_ptr == NULL)) \
59 EWF_LOG_ERROR("The allocator pointer is invalid."); \
60 return EWF_RESULT_INVALID_FUNCTION_ARGUMENT; \
64 #define EWF_ALLOCATOR_VALIDATE_POINTER(allocator_ptr) \
66 if ((allocator_ptr == NULL) || \
67 (allocator_ptr->implementation_ptr == NULL)) \
69 EWF_LOG_ERROR("The allocator pointer is invalid."); \
70 return EWF_RESULT_INVALID_FUNCTION_ARGUMENT; \
75 #ifdef EWF_PARAMETER_CHECKING
76 #define EWF_ALLOCATOR_VALIDATE_POINTER_TYPE(allocator_ptr, allocator_type) \
78 if ((allocator_ptr == NULL) || \
79 (allocator_ptr->struct_type != allocator_type)) \
81 EWF_LOG_ERROR("The allocator pointer type is invalid."); \
82 return EWF_RESULT_INVALID_FUNCTION_ARGUMENT; \
86 #define EWF_ALLOCATOR_VALIDATE_POINTER_TYPE(allocator_ptr, allocator_type)
The Embedded Wireless Framework.
ewf_result ewf_allocator_allocate(ewf_allocator *allocator_ptr, void **p)
Allocate a block from the allocator.
Definition: ewf_allocator.c:33
ewf_result ewf_allocator_release(ewf_allocator *allocator_ptr, void *p)
Release a block back to the allocator.
Definition: ewf_allocator.c:44
ewf_result ewf_allocator_start(ewf_allocator *allocator_ptr)
Start the allocator.
Definition: ewf_allocator.c:11
ewf_result ewf_allocator_stop(ewf_allocator *allocator_ptr)
Stop the allocator.
Definition: ewf_allocator.c:22
enum _ewf_result ewf_result
Success and error result codes specific to the EWF API.
The allocator structure definition.
Definition: ewf_allocator.h:27