38#ifndef UCX_LINKED_LIST_H
39#define UCX_LINKED_LIST_H
86#define cxLinkedListCreateSimple(item_size) \
87 cxLinkedListCreate(NULL, NULL, item_size)
109 ptrdiff_t loc_advance,
125 ptrdiff_t loc_advance,
389 void const *begin_left,
390 void const *begin_right,
391 ptrdiff_t loc_advance,
int(* cx_compare_func)(void const *left, void const *right)
A comparator function comparing two collection elements.
Definition: collection.h:55
Common definitions and feature checks.
#define __attribute__(x)
Removes GNU C attributes where they are not supported.
Definition: common.h:127
bool CX_DISABLE_LINKED_LIST_SWAP_SBO
Set this flag to true, if you want to disable the use of SBO for linked list swap operations.
void cx_linked_list_prepend(void **begin, void **end, ptrdiff_t loc_prev, ptrdiff_t loc_next, void *new_node)
Prepends a new node to a linked list.
void cx_linked_list_reverse(void **begin, void **end, ptrdiff_t loc_prev, ptrdiff_t loc_next)
Reverses the order of the nodes in a linked list.
void cx_linked_list_sort(void **begin, void **end, ptrdiff_t loc_prev, ptrdiff_t loc_next, ptrdiff_t loc_data, cx_compare_func cmp_func)
Sorts a linked list based on a comparison function.
ssize_t cx_linked_list_find(void const *start, ptrdiff_t loc_advance, ptrdiff_t loc_data, cx_compare_func cmp_func, void const *elem)
Finds the index of an element within a linked list.
void cx_linked_list_unlink(void *left, void *right, ptrdiff_t loc_prev, ptrdiff_t loc_next)
Unlinks two nodes.
void * cx_linked_list_last(void const *node, ptrdiff_t loc_next)
Finds the last node in a linked list.
void * cx_linked_list_at(void const *start, size_t start_index, ptrdiff_t loc_advance, size_t index)
Finds the node at a certain index.
CxList * cxLinkedListCreate(CxAllocator const *allocator, cx_compare_func comparator, size_t item_size)
Allocates a linked list for storing elements with item_size bytes each.
int cx_linked_list_compare(void const *begin_left, void const *begin_right, ptrdiff_t loc_advance, ptrdiff_t loc_data, cx_compare_func cmp_func)
Compares two lists element wise.
void * cx_linked_list_first(void const *node, ptrdiff_t loc_prev)
Finds the first node in a linked list.
void cx_linked_list_remove(void **begin, void **end, ptrdiff_t loc_prev, ptrdiff_t loc_next, void *node)
Removes a node from the linked list.
void cx_linked_list_insert_chain(void **begin, void **end, ptrdiff_t loc_prev, ptrdiff_t loc_next, void *node, void *insert_begin, void *insert_end)
Inserts a chain of nodes after a given node of a linked list.
size_t cx_linked_list_size(void const *node, ptrdiff_t loc_next)
Determines the size of a linked list starting with node.
void * cx_linked_list_prev(void const *begin, ptrdiff_t loc_next, void const *node)
Finds the predecessor of a node in case it is not linked.
void cx_linked_list_add(void **begin, void **end, ptrdiff_t loc_prev, ptrdiff_t loc_next, void *new_node)
Adds a new node to a linked list.
void cx_linked_list_link(void *left, void *right, ptrdiff_t loc_prev, ptrdiff_t loc_next)
Links two nodes.
void cx_linked_list_insert(void **begin, void **end, ptrdiff_t loc_prev, ptrdiff_t loc_next, void *node, void *new_node)
Inserts a new node after a given node of a linked list.
Interface for list implementations.
Structure holding the data for an allocator.
Definition: allocator.h:86
Structure for holding the base data of a list.
Definition: list.h:55