diff options
author | Tucker Evans <tucker@tuckerevans.com> | 2020-05-30 20:11:45 -0400 |
---|---|---|
committer | Tucker Evans <tucker@tuckerevans.com> | 2020-05-30 20:11:45 -0400 |
commit | 10cd9eadf3f14d4b25ef85ea563938a784fcf20c (patch) | |
tree | b43791b9c1b3917340242ce30fc55991041d927c /collections/double_ended_queue.h | |
parent | 4e4704b0251bb2b03d0fa573437b77b15567441c (diff) |
Add deq_clear function for double ended queue.
Frees all elements in double ended queue, does not free the queue struct
itself (deq_free is used for this).
Diffstat (limited to 'collections/double_ended_queue.h')
-rw-r--r-- | collections/double_ended_queue.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/collections/double_ended_queue.h b/collections/double_ended_queue.h index 226918d..7f11f66 100644 --- a/collections/double_ended_queue.h +++ b/collections/double_ended_queue.h @@ -11,8 +11,14 @@ deq* deq_with_capacity(int); int deq_size(deq*); int deq_capacity(deq*); deq* deq_cp(deq*); + +/* Note: Elements are not freed + * deq_clear should be called before if they are no longer needed.*/ void deq_free(deq*); +/*Free all elements within queue*/ +void deq_clear() + /*data*/ void deq_push_back(deq*, void*); void* deq_pop_front(deq*); @@ -20,6 +26,8 @@ void* deq_index(deq*, int); void* deq_pop_back(deq*); void deq_swap(deq*, int, int); + +/*Note: Does not currently reduce memory footprint*/ void deq_truncate(deq*, int); void* deq_front(deq*); |