1.1 --- a/src/cx/list.h Sun Mar 06 13:57:36 2022 +0100 1.2 +++ b/src/cx/list.h Sat Apr 09 16:37:43 2022 +0200 1.3 @@ -69,7 +69,7 @@ 1.4 /** 1.5 * The allocator to use. 1.6 */ 1.7 - CxAllocator *allocator; 1.8 + CxAllocator const *allocator; 1.9 /** 1.10 * A mandatory destructor for the list structure. 1.11 */ 1.12 @@ -202,6 +202,7 @@ 1.13 * @param content_autofree a flag indicating, if the list allocator shall free an element, 1.14 * if the content destructor did not do that or no content destructor exists 1.15 */ 1.16 +__attribute__((__nonnull__(1))) 1.17 static inline void cxListMemoryMgmt( 1.18 CxList *list, 1.19 cx_destructor_func list_destructor, 1.20 @@ -222,6 +223,7 @@ 1.21 * @param elem a pointer to the element to add 1.22 * @return zero on success, non-zero on memory allocation failure 1.23 */ 1.24 +__attribute__((__nonnull__)) 1.25 static inline int cxListAdd( 1.26 CxList *list, 1.27 void const *elem 1.28 @@ -242,6 +244,7 @@ 1.29 * @see cxListInsertAfter() 1.30 * @see cxListInsertBefore() 1.31 */ 1.32 +__attribute__((__nonnull__)) 1.33 static inline int cxListInsert( 1.34 CxList *list, 1.35 size_t index, 1.36 @@ -265,6 +268,7 @@ 1.37 * @see cxListInsert() 1.38 * @see cxListInsertBefore() 1.39 */ 1.40 +__attribute__((__nonnull__)) 1.41 static inline int cxListInsertAfter( 1.42 CxIterator *iter, 1.43 void const *elem 1.44 @@ -287,6 +291,7 @@ 1.45 * @see cxListInsert() 1.46 * @see cxListInsertAfter() 1.47 */ 1.48 +__attribute__((__nonnull__)) 1.49 static inline int cxListInsertBefore( 1.50 CxIterator *iter, 1.51 void const *elem 1.52 @@ -300,6 +305,7 @@ 1.53 * @param index the index of the element 1.54 * @return zero on success, non-zero if the index is out of bounds 1.55 */ 1.56 +__attribute__((__nonnull__)) 1.57 static inline int cxListRemove( 1.58 CxList *list, 1.59 size_t index 1.60 @@ -314,6 +320,7 @@ 1.61 * @param index the index of the element 1.62 * @return a pointer to the element or \c NULL if the index is out of bounds 1.63 */ 1.64 +__attribute__((__nonnull__)) 1.65 static inline void *cxListAt( 1.66 CxList *list, 1.67 size_t index 1.68 @@ -332,6 +339,7 @@ 1.69 * @param index the index where the iterator shall point at 1.70 * @return a new iterator 1.71 */ 1.72 +__attribute__((__nonnull__, __warn_unused_result__)) 1.73 static inline CxIterator cxListIterator( 1.74 CxList *list, 1.75 size_t index 1.76 @@ -349,6 +357,7 @@ 1.77 * @param list the list 1.78 * @return a new iterator 1.79 */ 1.80 +__attribute__((__nonnull__, __warn_unused_result__)) 1.81 static inline CxIterator cxListBegin(CxList *list) { 1.82 return list->cl->iterator(list, 0); 1.83 } 1.84 @@ -362,6 +371,7 @@ 1.85 * @param elem the element to find 1.86 * @return the index of the element or \c (size+1) if the element is not found 1.87 */ 1.88 +__attribute__((__nonnull__)) 1.89 static inline size_t cxListFind( 1.90 CxList *list, 1.91 void const *elem 1.92 @@ -376,6 +386,7 @@ 1.93 * 1.94 * @param list the list 1.95 */ 1.96 +__attribute__((__nonnull__)) 1.97 static inline void cxListSort(CxList *list) { 1.98 list->cl->sort(list); 1.99 } 1.100 @@ -385,6 +396,7 @@ 1.101 * 1.102 * @param list the list 1.103 */ 1.104 +__attribute__((__nonnull__)) 1.105 static inline void cxListReverse(CxList *list) { 1.106 list->cl->reverse(list); 1.107 } 1.108 @@ -398,6 +410,7 @@ 1.109 * @param other the list to compare to 1.110 * @return zero, if both lists are equal element wise, negative if the first list is smaller, zero if the first list is larger 1.111 */ 1.112 +__attribute__((__nonnull__)) 1.113 static inline int cxListCompare( 1.114 CxList *list, 1.115 CxList *other 1.116 @@ -415,7 +428,7 @@ 1.117 * This function itself is a destructor function for the CxList. 1.118 * 1.119 * @param list the list which contents shall be destroyed 1.120 - * @return \p list if the list structure has been free'd during the process 1.121 + * @return \p list if the list structure has not been free'd during the process 1.122 */ 1.123 __attribute__((__nonnull__)) 1.124 CxList *cxListDestroy(CxList *list);