src/cx/linked_list.h

changeset 438
cd3069757010
parent 415
067aa769796a
child 453
bb144d08cd44
equal deleted inserted replaced
437:9d4971ea0625 438:cd3069757010
34 34
35 #ifdef __cplusplus 35 #ifdef __cplusplus
36 extern "C" { 36 extern "C" {
37 #endif 37 #endif
38 38
39 /**
40 * Finds the node at a certain index.
41 *
42 * This function can be used to start at an arbitrary position within the list.
43 * If the search index is large than the start index, \p loc_advance must denote
44 * the location of some sort of \c next pointer (i.e. a pointer to the next node).
45 * But it is also possible that the search index is smaller than the start index
46 * (e.g. in cases where traversing a list backwards is faster) in which case
47 * \p loc_advance must denote the location of some sort of \c prev pointer
48 * (i.e. a pointer to the previous node).
49 *
50 * @param start a pointer to the start node
51 * @param start_index the start index
52 * @param loc_advance the location of the pointer to advance
53 * @param index the search index
54 * @return the node found at the specified index
55 */
56 void *cx_linked_list_at(void *start, size_t start_index, ptrdiff_t loc_advance, size_t index);
57
39 void *cx_linked_list_last(void **begin, void **end, ptrdiff_t loc_next); 58 void *cx_linked_list_last(void **begin, void **end, ptrdiff_t loc_next);
40 59
41 int cx_linked_list_add(void **begin, void **end, ptrdiff_t loc_prev, ptrdiff_t loc_next, void *new_node); 60 int cx_linked_list_add(void **begin, void **end, ptrdiff_t loc_prev, ptrdiff_t loc_next, void *new_node);
42 61
43 extern cx_list_class cx_linked_list_class; 62 extern cx_list_class cx_linked_list_class;

mercurial