72 void *cx_linked_list_at(void *start, size_t start_index, ptrdiff_t loc_advance, size_t index); |
72 void *cx_linked_list_at(void *start, size_t start_index, ptrdiff_t loc_advance, size_t index); |
73 |
73 |
74 /** |
74 /** |
75 * Finds the last node in a linked list. |
75 * Finds the last node in a linked list. |
76 * |
76 * |
77 * If a pointer to \p end is provided, the result is just \c *end. |
77 * The function starts with the pointer denoted by \p begin and traverses the list |
78 * Otherwise, this function starts with the pointer denoted by \c *begin and |
78 * along a next pointer whose location within the node struct is |
79 * traverses the list along a next pointer whose location within the node struct is |
|
80 * denoted by \p loc_next. |
79 * denoted by \p loc_next. |
81 * |
80 * |
82 * If both \p begin and \p end are \c NULL, an empty list is assumed and this function returns \c NULL. |
81 * @param begin a pointer to the begin node |
83 * |
82 * @param loc_next the location of the \c next pointer |
84 * @param begin a pointer to the begin node pointer (optional) |
83 * @return a pointer to the last node or \c NULL if \p begin is \c NULL |
85 * @param end a pointer to the end node pointer (optional) |
|
86 * @param loc_next the location of the \c next pointer (only required when \p end is \c NULL) |
|
87 * @return a pointer to the last node or \c NULL if the list is empty |
|
88 */ |
84 */ |
89 void *cx_linked_list_last(void **begin, void **end, ptrdiff_t loc_next); |
85 void *cx_linked_list_last(void *begin, ptrdiff_t loc_next); |
90 |
86 |
91 /** |
87 /** |
92 * Adds a new node to a linked list. |
88 * Adds a new node to a linked list. |
93 * |
89 * |
94 * \remark One of the pointers \p begin and \p end may be \c NULL, but not both. |
90 * \remark One of the pointers \p begin and \p end may be \c NULL, but not both. |