8 #ifndef CMAGIC_VECTOR_H 9 #define CMAGIC_VECTOR_H 25 cmagic_vector_free(
void **vector_ptr);
28 cmagic_vector_allocate_back(
void **vector_ptr);
31 cmagic_vector_push_back(
void **vector_ptr,
const void *new_element_ptr);
34 cmagic_vector_pop_back(
void **vector_ptr);
37 cmagic_vector_size(
void **vector_ptr);
40 cmagic_vector_get_alloc_packet(
void **vector_ptr);
46 #define CMAGIC_VECTOR(type) type** 53 #define CMAGIC_VECTOR_DATA(cmagic_vector) (*(cmagic_vector)) 61 #define CMAGIC_VECTOR_BACK(cmagic_vector) (assert(CMAGIC_VECTOR_SIZE(cmagic_vector) > 0), \ 62 CMAGIC_VECTOR_DATA(cmagic_vector) + CMAGIC_VECTOR_SIZE(cmagic_vector) - 1) 71 #define CMAGIC_VECTOR_NEW(type, alloc_packet) \ 72 ((CMAGIC_VECTOR(type))cmagic_vector_new(sizeof(type), (alloc_packet))) 79 #define CMAGIC_VECTOR_FREE(cmagic_vector) cmagic_vector_free((void**)(cmagic_vector)) 88 #define CMAGIC_VECTOR_ALLOCATE_BACK(cmagic_vector) \ 89 cmagic_vector_allocate_back((void**)(cmagic_vector)) 99 #define CMAGIC_VECTOR_PUSH_BACK(cmagic_vector, new_element_ptr) \ 100 (CMAGIC_UTILS_ASSERT_SAME_TYPE(**(cmagic_vector), *(new_element_ptr)), \ 101 cmagic_vector_push_back((void**)(cmagic_vector), (new_element_ptr))) 108 #define CMAGIC_VECTOR_POP_BACK(cmagic_vector) cmagic_vector_pop_back((void**)(cmagic_vector)) 115 #define CMAGIC_VECTOR_SIZE(cmagic_vector) cmagic_vector_size((void**)(cmagic_vector)) 123 #define CMAGIC_VECTOR_GET_ALLOC_PACKET(cmagic_vector) \ 124 cmagic_vector_get_alloc_packet((void**)(cmagic_vector)) Portable substitutes of standard malloc() and free() functions.
Set of allocation functions. Used in some CMagic structures to specify a desired memory pool...
Definition: memory.h:187
General purpose utilities.