src/cx/linked_list.h

changeset 855
35bcb3216c0d
parent 807
c8d692131b1e
child 878
1c1ee61c01f9
equal deleted inserted replaced
854:fe0d69d72bcd 855:35bcb3216c0d
48 * The maximum item size that uses SBO swap instead of relinking. 48 * The maximum item size that uses SBO swap instead of relinking.
49 */ 49 */
50 extern unsigned cx_linked_list_swap_sbo_size; 50 extern unsigned cx_linked_list_swap_sbo_size;
51 51
52 /** 52 /**
53 * Allocates a linked list for storing elements with \p item_size bytes each. 53 * Allocates a linked list for storing elements with \p elem_size bytes each.
54 * 54 *
55 * If \p item_size is CX_STORE_POINTERS, the created list will be created as if 55 * If \p elem_size is CX_STORE_POINTERS, the created list will be created as if
56 * cxListStorePointers() was called immediately after creation and the compare 56 * cxListStorePointers() was called immediately after creation and the compare
57 * function will be automatically set to cx_cmp_ptr(), if none is given. 57 * function will be automatically set to cx_cmp_ptr(), if none is given.
58 * 58 *
59 * @param allocator the allocator for allocating the list nodes 59 * @param allocator the allocator for allocating the list nodes
60 * (if \c NULL the cxDefaultAllocator will be used) 60 * (if \c NULL the cxDefaultAllocator will be used)
61 * @param comparator the comparator for the elements 61 * @param comparator the comparator for the elements
62 * (if \c NULL, and the list is not storing pointers, sort and find 62 * (if \c NULL, and the list is not storing pointers, sort and find
63 * functions will not work) 63 * functions will not work)
64 * @param item_size the size of each element in bytes 64 * @param elem_size the size of each element in bytes
65 * @return the created list 65 * @return the created list
66 */ 66 */
67 CxList *cxLinkedListCreate( 67 CxList *cxLinkedListCreate(
68 CxAllocator const *allocator, 68 CxAllocator const *allocator,
69 cx_compare_func comparator, 69 cx_compare_func comparator,
70 size_t item_size 70 size_t elem_size
71 ); 71 );
72 72
73 /** 73 /**
74 * Allocates a linked list for storing elements with \p item_size bytes each. 74 * Allocates a linked list for storing elements with \p elem_size bytes each.
75 * 75 *
76 * 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
77 * to call functions that need a comparator, you must either set one immediately 77 * to call functions that need a comparator, you must either set one immediately
78 * after list creation or use cxLinkedListCreate(). 78 * after list creation or use cxLinkedListCreate().
79 * 79 *
80 * If \p item_size is CX_STORE_POINTERS, the created list will be created as if 80 * If \p elem_size is CX_STORE_POINTERS, the created list will be created as if
81 * cxListStorePointers() was called immediately after creation and the compare 81 * cxListStorePointers() was called immediately after creation and the compare
82 * function will be automatically set to cx_cmp_ptr(). 82 * function will be automatically set to cx_cmp_ptr().
83 * 83 *
84 * @param item_size the size of each element in bytes 84 * @param elem_size the size of each element in bytes
85 * @return the created list 85 * @return the created list
86 */ 86 */
87 #define cxLinkedListCreateSimple(item_size) \ 87 #define cxLinkedListCreateSimple(elem_size) \
88 cxLinkedListCreate(NULL, NULL, item_size) 88 cxLinkedListCreate(NULL, NULL, elem_size)
89 89
90 /** 90 /**
91 * Finds the node at a certain index. 91 * Finds the node at a certain index.
92 * 92 *
93 * This function can be used to start at an arbitrary position within the list. 93 * This function can be used to start at an arbitrary position within the list.

mercurial