56 * |
56 * |
57 * If \p item_size is CX_STORE_POINTERS, the created list will be created as if |
57 * If \p item_size is CX_STORE_POINTERS, the created list will be created as if |
58 * cxListStorePointers() was called immediately after creation. |
58 * cxListStorePointers() was called immediately after creation. |
59 * |
59 * |
60 * @param allocator the allocator for allocating the list nodes |
60 * @param allocator the allocator for allocating the list nodes |
|
61 * (if \c NULL the cxDefaultAllocator will be used) |
61 * @param comparator the comparator for the elements |
62 * @param comparator the comparator for the elements |
|
63 * (if \c NULL sort and find functions will not work) |
62 * @param item_size the size of each element in bytes |
64 * @param item_size the size of each element in bytes |
63 * @return the created list |
65 * @return the created list |
64 */ |
66 */ |
65 CxList *cxLinkedListCreate( |
67 CxList *cxLinkedListCreate( |
66 CxAllocator const *allocator, |
68 CxAllocator const *allocator, |
67 CxListComparator comparator, |
69 CxListComparator comparator, |
68 size_t item_size |
70 size_t item_size |
69 ) __attribute__((__nonnull__)); |
71 ); |
70 |
72 |
71 /** |
73 /** |
72 * Allocates a linked list for storing elements with \p item_size bytes each. |
74 * Allocates a linked list for storing elements with \p item_size bytes each. |
73 * |
75 * |
74 * The list will use cxDefaultAllocator and no comparator function. If you want |
76 * The list will use cxDefaultAllocator and no comparator function. If you want |
79 * cxListStorePointers() was called immediately after creation. |
81 * cxListStorePointers() was called immediately after creation. |
80 * |
82 * |
81 * @param item_size the size of each element in bytes |
83 * @param item_size the size of each element in bytes |
82 * @return the created list |
84 * @return the created list |
83 */ |
85 */ |
84 CxList *cxLinkedListCreateSimple(size_t item_size); |
86 #define cxLinkedListCreateSimple(item_size) \ |
|
87 cxLinkedListCreate(NULL, NULL, item_size) |
85 |
88 |
86 /** |
89 /** |
87 * Finds the node at a certain index. |
90 * Finds the node at a certain index. |
88 * |
91 * |
89 * This function can be used to start at an arbitrary position within the list. |
92 * This function can be used to start at an arbitrary position within the list. |