1.1 --- a/src/cx/linked_list.h Mon Dec 20 11:26:39 2021 +0100 1.2 +++ b/src/cx/linked_list.h Mon Dec 20 11:58:36 2021 +0100 1.3 @@ -94,7 +94,8 @@ 1.4 * @param index the search index 1.5 * @return the node found at the specified index 1.6 */ 1.7 -void *cx_linked_list_at(void *start, size_t start_index, ptrdiff_t loc_advance, size_t index); 1.8 +void *cx_linked_list_at(void *start, size_t start_index, ptrdiff_t loc_advance, size_t index) 1.9 +__attribute__((__nonnull__)); 1.10 1.11 /** 1.12 * Finds the first node in a linked list. 1.13 @@ -105,9 +106,9 @@ 1.14 * 1.15 * @param node a pointer to a node in the list 1.16 * @param loc_prev the location of the \c prev pointer 1.17 - * @return a pointer to the first node or \c NULL if \p node is \c NULL 1.18 */ 1.19 -void *cx_linked_list_first(void *node, ptrdiff_t loc_prev); 1.20 +void *cx_linked_list_first(void *node, ptrdiff_t loc_prev) 1.21 +__attribute__((__nonnull__)); 1.22 1.23 /** 1.24 * Finds the last node in a linked list. 1.25 @@ -118,9 +119,10 @@ 1.26 * 1.27 * @param node a pointer to a node in the list 1.28 * @param loc_next the location of the \c next pointer 1.29 - * @return a pointer to the last node or \c NULL if \p begin is \c NULL 1.30 + * @return a pointer to the last node 1.31 */ 1.32 -void *cx_linked_list_last(void *node, ptrdiff_t loc_next); 1.33 +void *cx_linked_list_last(void *node, ptrdiff_t loc_next) 1.34 +__attribute__((__nonnull__)); 1.35 1.36 /** 1.37 * Finds the predecessor of a node in case it is not linked. 1.38 @@ -132,13 +134,14 @@ 1.39 * @param node the successor of the node to find 1.40 * @return the node or \c NULL if \p node has no predecessor 1.41 */ 1.42 -void *cx_linked_list_prev(void *begin, ptrdiff_t loc_next, void *node); 1.43 +void *cx_linked_list_prev(void *begin, ptrdiff_t loc_next, void *node) 1.44 +__attribute__((__nonnull__)); 1.45 1.46 /** 1.47 * Adds a new node to a linked list. 1.48 * The node must not be part of any list already. 1.49 * 1.50 - * \remark One of the pointers \p begin and \p end may be \c NULL, but not both. 1.51 + * \remark One of the pointers \p begin or \p end may be \c NULL, but not both. 1.52 * 1.53 * @param begin a pointer to the begin node pointer (if your list has one) 1.54 * @param end a pointer to the end node pointer (if your list has one) 1.55 @@ -146,13 +149,14 @@ 1.56 * @param loc_next the location of a \c next pointer within your node struct (required) 1.57 * @param new_node a pointer to the node that shall be appended 1.58 */ 1.59 -void cx_linked_list_add(void **begin, void **end, ptrdiff_t loc_prev, ptrdiff_t loc_next, void *new_node); 1.60 +void cx_linked_list_add(void **begin, void **end, ptrdiff_t loc_prev, ptrdiff_t loc_next, void *new_node) 1.61 +__attribute__((__nonnull__(5))); 1.62 1.63 /** 1.64 * Prepends a new node to a linked list. 1.65 * The node must not be part of any list already. 1.66 * 1.67 - * \remark One of the pointers \p begin and \p end may be \c NULL, but not both. 1.68 + * \remark One of the pointers \p begin or \p end may be \c NULL, but not both. 1.69 * 1.70 * @param begin a pointer to the begin node pointer (if your list has one) 1.71 * @param end a pointer to the end node pointer (if your list has one) 1.72 @@ -160,7 +164,8 @@ 1.73 * @param loc_next the location of a \c next pointer within your node struct (required) 1.74 * @param new_node a pointer to the node that shall be prepended 1.75 */ 1.76 -void cx_linked_list_prepend(void **begin, void **end, ptrdiff_t loc_prev, ptrdiff_t loc_next, void *new_node); 1.77 +void cx_linked_list_prepend(void **begin, void **end, ptrdiff_t loc_prev, ptrdiff_t loc_next, void *new_node) 1.78 +__attribute__((__nonnull__(5))); 1.79 1.80 /** 1.81 * Removes a node from the linked list. 1.82 @@ -181,8 +186,8 @@ 1.83 * @param loc_next the location of a \c next pointer within your node struct (required) 1.84 * @param node the node to remove 1.85 */ 1.86 - void cx_linked_list_remove(void **begin, void **end, ptrdiff_t loc_prev, ptrdiff_t loc_next, void *node) 1.87 - __attribute__ ((nonnull(5))); 1.88 +void cx_linked_list_remove(void **begin, void **end, ptrdiff_t loc_prev, ptrdiff_t loc_next, void *node) 1.89 +__attribute__((__nonnull__(5))); 1.90 1.91 1.92 /** 1.93 @@ -225,7 +230,8 @@ 1.94 * @param cmp_func the compare function defining the sort order 1.95 */ 1.96 void cx_linked_list_sort(void **begin, void **end, ptrdiff_t loc_prev, ptrdiff_t loc_next, 1.97 - ptrdiff_t loc_data, int follow_ptr, CxListComparator cmp_func); 1.98 + ptrdiff_t loc_data, int follow_ptr, CxListComparator cmp_func) 1.99 +__attribute__((__nonnull__(1, 7))); 1.100 1.101 1.102 /** 1.103 @@ -236,7 +242,8 @@ 1.104 * @param loc_prev the location of a \c prev pointer within your node struct (negative if your struct does not have one) 1.105 * @param loc_next the location of a \c next pointer within your node struct (required) 1.106 */ 1.107 -void cx_linked_list_reverse(void **begin, void **end, ptrdiff_t loc_prev, ptrdiff_t loc_next); 1.108 +void cx_linked_list_reverse(void **begin, void **end, ptrdiff_t loc_prev, ptrdiff_t loc_next) 1.109 +__attribute__((__nonnull__(1))); 1.110 1.111 #ifdef __cplusplus 1.112 } /* extern "C" */