Reduce malloc calls in stack (#78)

This commit is contained in:
Bailey Thompson
2020-08-10 12:30:51 -04:00
committed by GitHub
parent c74b0c4caf
commit af869f2b46
4 changed files with 17 additions and 50 deletions

View File

@@ -455,13 +455,13 @@ deque deque_destroy(deque me);
* The stack data structure, which adapts a container to provide a stack
* (last-in first-out). Adapts the deque container.
*/
typedef struct internal_stack *stack;
typedef struct internal_deque *stack;
/* Starting */
stack stack_init(size_t data_size);
/* Utility */
int stack_size(stack me);
size_t stack_size(stack me);
int stack_is_empty(stack me);
int stack_trim(stack me);
void stack_copy_to_array(void *arr, stack me);