52 extern bool CX_DISABLE_LINKED_LIST_SWAP_SBO; |
52 extern bool CX_DISABLE_LINKED_LIST_SWAP_SBO; |
53 |
53 |
54 /** |
54 /** |
55 * Allocates a linked list for storing elements with \p item_size bytes each. |
55 * Allocates a linked list for storing elements with \p item_size bytes each. |
56 * |
56 * |
57 * @remark Elements added to the list are copied, therefore a possible destructor |
|
58 * MUST NOT free the memory pointed to by its argument. |
|
59 * |
|
60 * @param allocator the allocator for allocating the list nodes |
57 * @param allocator the allocator for allocating the list nodes |
61 * @param comparator the comparator for the elements |
58 * @param comparator the comparator for the elements |
62 * @param item_size the size of each element in bytes |
59 * @param item_size the size of each element in bytes |
63 * @return the created list |
60 * @return the created list |
64 */ |
61 */ |
65 CxList *cxLinkedListCreate( |
62 CxList *cxLinkedListCreate( |
66 CxAllocator const *allocator, |
63 CxAllocator const *allocator, |
67 CxListComparator comparator, |
64 CxListComparator comparator, |
68 size_t item_size |
65 size_t item_size |
69 ) __attribute__((__nonnull__)); |
66 ) __attribute__((__nonnull__)); |
|
67 |
|
68 /** |
|
69 * Allocates a linked list for storing elements with \p item_size bytes each. |
|
70 * |
|
71 * The list will use cxDefaultAllocator and no comparator function. If you want |
|
72 * to call functions that need a comparator, you must either set one immediately |
|
73 * after list creation or use cxLinkedListCreate(). |
|
74 * |
|
75 * @param item_size the size of each element in bytes |
|
76 * @return the created list |
|
77 */ |
|
78 CxList *cxLinkedListCreateSimple(size_t item_size); |
70 |
79 |
71 /** |
80 /** |
72 * Finds the node at a certain index. |
81 * Finds the node at a certain index. |
73 * |
82 * |
74 * This function can be used to start at an arbitrary position within the list. |
83 * This function can be used to start at an arbitrary position within the list. |