src/cx/linked_list.h

changeset 480
e3be53a3354f
parent 478
599770bb6314
child 481
eef025d82a34
     1.1 --- a/src/cx/linked_list.h	Mon Dec 20 12:10:48 2021 +0100
     1.2 +++ b/src/cx/linked_list.h	Mon Dec 20 13:01:38 2021 +0100
     1.3 @@ -98,6 +98,22 @@
     1.4  __attribute__((__nonnull__));
     1.5  
     1.6  /**
     1.7 + * Finds the index of an element within a linked list.
     1.8 + *
     1.9 + * @param start a pointer to the start node
    1.10 + * @param loc_advance the location of the pointer to advance
    1.11 + * @param loc_data the location of the \c data pointer within your node struct
    1.12 + * @param follow_ptr \c false if the pointer denoted by \p loc_data shall be passed to the \p cmp_func.
    1.13 + * If \c true, the data at \p loc_data is assumed to be a pointer, dereferenced, and then passed to \p cmp_func.
    1.14 + * @param cmp_func a compare function to compare \p elem against the node data
    1.15 + * @param elem a pointer to the element to find
    1.16 + * @return the index of the element or a past-one index if the element could not be found
    1.17 + */
    1.18 +size_t cx_linked_list_find(void *start, ptrdiff_t loc_advance, ptrdiff_t loc_data, int follow_ptr,
    1.19 +                           CxListComparator cmp_func, void *elem)
    1.20 +__attribute__((__nonnull__));
    1.21 +
    1.22 +/**
    1.23   * Finds the first node in a linked list.
    1.24   *
    1.25   * The function starts with the pointer denoted by \p node and traverses the list
    1.26 @@ -226,7 +242,7 @@
    1.27   * @param loc_next the location of a \c next pointer within your node struct (required)
    1.28   * @param loc_data the location of the \c data pointer within your node struct
    1.29   * @param follow_ptr \c false if the pointer denoted by \p loc_data shall be passed to the \p cmp_func.
    1.30 - * If \c true, the data at \p loc_data is dereferenced, assuming to be a pointer, and then passed to \p cmp_func.
    1.31 + * If \c true, the data at \p loc_data is assumed to be a pointer, dereferenced, and then passed to \p cmp_func.
    1.32   * @param cmp_func the compare function defining the sort order
    1.33   */
    1.34  void cx_linked_list_sort(void **begin, void **end, ptrdiff_t loc_prev, ptrdiff_t loc_next,

mercurial