/** * Destroy vector container. */ void vector_destroy(vector_t* pvec_vector) { assert(pvec_vector != NULL); assert(_vector_is_inited(pvec_vector) || _vector_is_created(pvec_vector)); _vector_destroy_auxiliary(pvec_vector); /* free memory that malloced in _create_vector() function */ free(pvec_vector); }
/** * Destroy stack container auxiliary function. */ void _stack_destroy_auxiliary(stack_t* psk_stack) { assert(psk_stack != NULL); #if defined (CSTL_STACK_VECTOR_SEQUENCE) _vector_destroy_auxiliary(&psk_stack->_t_sequence); #elif defined (CSTL_STACK_LIST_SEQUENCE) _list_destroy_auxiliary(&psk_stack->_t_sequence); #else _deque_destroy_auxiliary(&psk_stack->_t_sequence); #endif }
void _type_destroy_vector(const void* cpv_input, void* pv_output) { assert(cpv_input != NULL && pv_output != NULL); _vector_destroy_auxiliary((vector_t*)cpv_input); *(bool_t*)pv_output = true; }