|
Veritable Lasagna
An Allocator & Data Structure Library for C.
|
Include dependency graph for vl_linked_list.c:Functions | |
| void | vlListInit (vl_linked_list *list, vl_uint16_t elementSize) |
| Initializes the specified list instance. | |
| vl_linked_list * | vlListNew (vl_uint16_t elementSize) |
| Allocates on the heap, initializes, and returns a new list instance. | |
| void | vlListDelete (vl_linked_list *list) |
| Deletes the specified list instance and its internal pool. | |
| vl_list_iter | vlListPushFront (vl_linked_list *list, const void *elem) |
| Adds a new element to the front of the list. | |
| void | vlListPopFront (vl_linked_list *list) |
| Removes whatever element is at the front of the list. | |
| vl_list_iter | vlListPushBack (vl_linked_list *list, const void *elem) |
| Adds a new element to the end of the list. | |
| void | vlListPopBack (vl_linked_list *list) |
| Removes whatever element is at the end of the list. | |
| vl_list_iter | vlListInsertAfter (vl_linked_list *list, vl_list_iter target, const void *elem) |
| Inserts an element immediately after the specified target. | |
| vl_list_iter | vlListInsertBefore (vl_linked_list *list, vl_list_iter target, const void *elem) |
| Inserts an element immediately before the specified target. | |
| vl_linked_list * | vlListClone (const vl_linked_list *src, vl_linked_list *dest) |
| Clones the specified list to another. | |
| int | vlListCopy (vl_linked_list *src, vl_list_iter begin, vl_list_iter end, vl_linked_list *dest, vl_list_iter after) |
| Copies a range of elements from one list to another. | |
| void | vlListSort (vl_linked_list *list, vl_compare_function compareFunction) |
| Sorts the specified list in-place using the given comparator. | |
| vl_list_iter | vlListFind (vl_linked_list *src, const void *element) |
| Performs an iterative search on the specified list. | |
| void | vlListRemove (vl_linked_list *list, vl_list_iter iter) |
| Removes the specified element from the list. | |
| vl_list_iter | vlListNext (vl_linked_list *list, vl_list_iter iter) |
| Returns next adjacent iterator, or VL_LIST_ITER_INVALID if no such element exists. | |
| vl_list_iter | vlListPrev (vl_linked_list *list, vl_list_iter iter) |
| Returns the previous adjacent iterator, or VL_LIST_ITER_INVALID if no such element exists. | |
| void * | vlListSample (vl_linked_list *list, vl_list_iter iter) |
| Returns a pointer to the element data for the specified iterator. | |
| vl_linked_list * vlListClone | ( | const vl_linked_list * | src, |
| vl_linked_list * | dest | ||
| ) |
Clones the specified list to another.
Clones the entirety of the src list to the dest list, including all element data and order.
The 'src' list pointer must be non-null and initialized. The 'dest' list pointer may be null, but if it is not null it must be initialized.
If the 'dest' list pointer is null, a new list is created via vlListNew. Otherwise, its element size is set to the source's and all of its existing data is replaced.
dest is NULL, the caller owns the returned vl_linked_list. If dest is provided, ownership remains with the caller.src must not be NULL. dest can be NULL.NULL if allocation fails.dest is NULL) and multiple nodes.NULL on failure.| src | |
| dest |
Here is the call graph for this function:| int vlListCopy | ( | vl_linked_list * | src, |
| vl_list_iter | begin, | ||
| vl_list_iter | end, | ||
| vl_linked_list * | dest, | ||
| vl_list_iter | after | ||
| ) |
Copies a range of elements from one list to another.
Both the src list and the dest list must have equivalent element sizes, otherwise this is a no-op.
This is an inclusive range, and as such, the elements referred to by the begin and end iterators are also copied to the target list.
The begin and end iterators are expected to be in logical iterative order, meaning that if iterating through the entire src list, begin would be found before end.
dest maintains copies of the elements.src and dest must not be NULL.dest.| src | source list pointer |
| begin | iterator to start the copy at, or VL_LIST_ITER_INVALID for the beginning of the list. |
| end | iterator to end the copy after, or VL_LIST_ITER_INVALID for the end of the list. |
| dest | destination buffer pointer |
| after | the iterator to insert elements after, or VL_LIST_ITER_INVALID for the end of the destination. |
Here is the call graph for this function:| void vlListDelete | ( | vl_linked_list * | list | ) |
Deletes the specified list instance and its internal pool.
The specified list should be created via vlListNew.
vl_linked_list struct.list is NULL.| list | pointer |
| vl_list_iter vlListFind | ( | vl_linked_list * | src, |
| const void * | element | ||
| ) |
Performs an iterative search on the specified list.
This will return an iterator to the first instance of the specified element that was found using the default comparator.
src must not be NULL. element must not be NULL.VL_LIST_ITER_INVALID if the element is not found.vl_list_iter to the found element, or VL_LIST_ITER_INVALID.| src | source list pointer |
| element | pointer to the element to compare against |
Here is the call graph for this function:| void vlListInit | ( | vl_linked_list * | list, |
| vl_uint16_t | elementSize | ||
| ) |
Initializes the specified list instance.
The initialized list should be freed via vlListFree.
list struct. The function initializes the internal node pool.vlListFree or vlListDelete.list must not be NULL.vlListFree (causes memory leak).vl_pool which allocates management structures.| list | pointer |
| elementSize | size of a single list element, in bytes. |
Here is the caller graph for this function:| vl_list_iter vlListInsertAfter | ( | vl_linked_list * | list, |
| vl_list_iter | target, | ||
| const void * | elem | ||
| ) |
Inserts an element immediately after the specified target.
Element data is copied to the internal pool allocator.
list must not be NULL. target must not be VL_LIST_ITER_INVALID. elem can be NULL.VL_LIST_ITER_INVALID if allocation fails.vl_list_iter handle to the new element, or VL_LIST_ITER_INVALID.| list | pointer |
| target | iterator to element that will have something inserted after it. |
| elem | pointer |
Here is the call graph for this function:
Here is the caller graph for this function:| vl_list_iter vlListInsertBefore | ( | vl_linked_list * | list, |
| vl_list_iter | target, | ||
| const void * | elem | ||
| ) |
Inserts an element immediately before the specified target.
Element data is copied to the internal pool allocator.
vlListInsertAfter.vlListInsertAfter.vlListInsertAfter.vl_list_iter handle to the new element, or VL_LIST_ITER_INVALID.| list | pointer |
| target | iterator to element that will have something inserted before it. |
| elem |
Here is the call graph for this function:| vl_linked_list * vlListNew | ( | vl_uint16_t | elementSize | ) |
Allocates on the heap, initializes, and returns a new list instance.
vl_linked_list pointer and is responsible for calling vlListDelete.vlListDelete.NULL if heap allocation for the list struct fails.NULL on allocation failure.vl_linked_list struct and its internal pool.NULL.| elementSize | size of a single list element, in bytes. |
Here is the call graph for this function:
Here is the caller graph for this function:| vl_list_iter vlListNext | ( | vl_linked_list * | list, |
| vl_list_iter | iter | ||
| ) |
Returns next adjacent iterator, or VL_LIST_ITER_INVALID if no such element exists.
list must not be NULL.VL_LIST_ITER_INVALID if no next element.vl_list_iter in the sequence.| list | pointer |
| iter | node iterator |
Here is the call graph for this function:
Here is the caller graph for this function:| void vlListPopBack | ( | vl_linked_list * | list | ) |
Removes whatever element is at the end of the list.
This is a no-op if the list is empty.
list must not be NULL.| list | pointer |
Here is the call graph for this function:| void vlListPopFront | ( | vl_linked_list * | list | ) |
Removes whatever element is at the front of the list.
This is a no-op if the list is empty.
list must not be NULL.| list | pointer |
Here is the call graph for this function:| vl_list_iter vlListPrev | ( | vl_linked_list * | list, |
| vl_list_iter | iter | ||
| ) |
Returns the previous adjacent iterator, or VL_LIST_ITER_INVALID if no such element exists.
vlListNext.vlListNext.vlListNext.VL_LIST_ITER_INVALID if no previous element.vlListNext.vl_list_iter in the sequence.| list | pointer |
| iter | node iterator |
Here is the call graph for this function:| vl_list_iter vlListPushBack | ( | vl_linked_list * | list, |
| const void * | elem | ||
| ) |
Adds a new element to the end of the list.
Element data is copied to the internal pool allocator.
list must not be NULL. elem can be NULL.VL_LIST_ITER_INVALID if allocation fails.vl_list_iter handle to the new element, or VL_LIST_ITER_INVALID.| list | pointer |
| elem | pointer to element data |
Here is the call graph for this function:
Here is the caller graph for this function:| vl_list_iter vlListPushFront | ( | vl_linked_list * | list, |
| const void * | elem | ||
| ) |
Adds a new element to the front of the list.
Element data is copied to the internal pool allocator.
elem. The list maintains a copy.list must not be NULL. elem can be NULL (initializes with zero/garbage depending on pool implementation).VL_LIST_ITER_INVALID if node allocation fails.vl_list_iter handle to the new element, or VL_LIST_ITER_INVALID on failure.| list | pointer |
| elem | pointer to element data |
Here is the call graph for this function:
Here is the caller graph for this function:| void vlListRemove | ( | vl_linked_list * | list, |
| vl_list_iter | iter | ||
| ) |
Removes the specified element from the list.
The underlying node is returned to the underlying node pool for reuse, without modifying its discarded data.
list must not be NULL. iter should not be VL_LIST_ITER_INVALID.| list | pointer |
| iter | node iterator. |
Here is the call graph for this function:| void * vlListSample | ( | vl_linked_list * | list, |
| vl_list_iter | iter | ||
| ) |
Returns a pointer to the element data for the specified iterator.
NULL if iter is VL_LIST_ITER_INVALID.| list | pointer |
| iter | node iterator |
Here is the call graph for this function:
Here is the caller graph for this function:| void vlListSort | ( | vl_linked_list * | src, |
| vl_compare_function | cmp | ||
| ) |
Sorts the specified list in-place using the given comparator.
This function implements an iterative merge sort. Elements are not copied in this operation, but rather the links between them are modified.
The list is split into a "forest" in the underlying node pool, briefly holding a variety of sub-lists which are later merged back together.
list and cmp must not be NULL.NULL comparator or an uninitialized list.| src | source list pointer |
| cmp | comparator function |
Here is the call graph for this function: