src/cx/linked_list.h

changeset 764
ccbdbd088455
parent 763
741a2040fa33
child 807
c8d692131b1e
     1.1 --- a/src/cx/linked_list.h	Mon Dec 18 16:14:07 2023 +0100
     1.2 +++ b/src/cx/linked_list.h	Mon Dec 18 18:22:53 2023 +0100
     1.3 @@ -131,6 +131,27 @@
     1.4  ) __attribute__((__nonnull__));
     1.5  
     1.6  /**
     1.7 + * Finds the node containing an element within a linked list.
     1.8 + *
     1.9 + * @param result a pointer to the memory where the node pointer (or \c NULL if the element
    1.10 + * could not be found) shall be stored to
    1.11 + * @param start a pointer to the start node
    1.12 + * @param loc_advance the location of the pointer to advance
    1.13 + * @param loc_data the location of the \c data pointer within your node struct
    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 negative value if it could not be found
    1.17 + */
    1.18 +ssize_t cx_linked_list_find_node(
    1.19 +        void **result,
    1.20 +        void const *start,
    1.21 +        ptrdiff_t loc_advance,
    1.22 +        ptrdiff_t loc_data,
    1.23 +        cx_compare_func cmp_func,
    1.24 +        void const *elem
    1.25 +) __attribute__((__nonnull__));
    1.26 +
    1.27 +/**
    1.28   * Finds the first node in a linked list.
    1.29   *
    1.30   * The function starts with the pointer denoted by \p node and traverses the list

mercurial