Sun, 07 Dec 2025 19:20:48 +0100
implement radiobutton (Client)
| 174 | 1 | /* |
| 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. | |
| 3 | * | |
| 4 | * Copyright 2021 Mike Becker, Olaf Wintermann All rights reserved. | |
| 5 | * | |
| 6 | * Redistribution and use in source and binary forms, with or without | |
| 7 | * modification, are permitted provided that the following conditions are met: | |
| 8 | * | |
| 9 | * 1. Redistributions of source code must retain the above copyright | |
| 10 | * notice, this list of conditions and the following disclaimer. | |
| 11 | * | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * | |
| 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |
| 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE | |
| 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
| 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
| 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
| 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
| 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
| 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
| 26 | * POSSIBILITY OF SUCH DAMAGE. | |
| 27 | */ | |
| 28 | /** | |
| 440 | 29 | * @file list.h |
| 30 | * @brief Interface for list implementations. | |
| 31 | * @author Mike Becker | |
| 32 | * @author Olaf Wintermann | |
| 33 | * @copyright 2-Clause BSD License | |
| 174 | 34 | */ |
| 35 | ||
| 36 | #ifndef UCX_LIST_H | |
| 37 | #define UCX_LIST_H | |
| 38 | ||
| 39 | #include "common.h" | |
| 40 | #include "collection.h" | |
| 41 | ||
| 42 | #ifdef __cplusplus | |
| 43 | extern "C" { | |
| 44 | #endif | |
| 45 | ||
| 46 | /** | |
| 47 | * List class type. | |
| 48 | */ | |
| 49 | typedef struct cx_list_class_s cx_list_class; | |
| 50 | ||
| 51 | /** | |
| 52 | * Structure for holding the base data of a list. | |
| 53 | */ | |
| 54 | struct cx_list_s { | |
| 440 | 55 | /** |
| 56 | * Common members for collections. | |
| 57 | */ | |
| 324 | 58 | CX_COLLECTION_BASE; |
| 174 | 59 | /** |
| 60 | * The list class definition. | |
| 61 | */ | |
| 324 | 62 | const cx_list_class *cl; |
| 174 | 63 | /** |
| 64 | * The actual implementation in case the list class is delegating. | |
| 65 | */ | |
| 324 | 66 | const cx_list_class *climpl; |
| 174 | 67 | }; |
| 68 | ||
| 69 | /** | |
| 70 | * The class definition for arbitrary lists. | |
| 71 | */ | |
| 72 | struct cx_list_class_s { | |
| 73 | /** | |
| 74 | * Destructor function. | |
| 75 | * | |
| 76 | * Implementations SHALL invoke the content destructor functions if provided | |
| 440 | 77 | * and SHALL deallocate the entire list memory. |
| 174 | 78 | */ |
| 440 | 79 | void (*deallocate)(struct cx_list_s *list); |
| 174 | 80 | |
| 81 | /** | |
|
187
24ce2c326d85
implement toggle button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
174
diff
changeset
|
82 | * Member function for inserting a single element. |
| 845 | 83 | * The data pointer may be @c NULL, in which case the function shall only allocate memory. |
| 84 | * Returns a pointer to the allocated memory or @c NULL if allocation fails. | |
| 174 | 85 | */ |
| 870 | 86 | void *(*insert_element)(struct cx_list_s *list, size_t index, const void *data); |
| 174 | 87 | |
| 88 | /** | |
| 89 | * Member function for inserting multiple elements. | |
| 440 | 90 | * |
| 870 | 91 | * The data pointer may be @c NULL, in which case the function shall only allocate memory. |
| 92 | * Returns the number of successfully inserted or allocated elements. | |
| 93 | * | |
| 324 | 94 | * @see cx_list_default_insert_array() |
| 174 | 95 | */ |
| 870 | 96 | size_t (*insert_array)(struct cx_list_s *list, size_t index, const void *data, size_t n); |
| 324 | 97 | |
| 98 | /** | |
| 99 | * Member function for inserting sorted elements into a sorted list. | |
| 870 | 100 | * Returns the number of successfully inserted elements. |
| 324 | 101 | * |
| 102 | * @see cx_list_default_insert_sorted() | |
| 103 | */ | |
| 870 | 104 | size_t (*insert_sorted)(struct cx_list_s *list, const void *sorted_data, size_t n); |
| 174 | 105 | |
| 106 | /** | |
| 845 | 107 | * Member function for inserting multiple elements if they do not exist. |
| 870 | 108 | * Implementations shall return the number of successfully processed elements |
| 109 | * (including those which were not added because they are already contained). | |
| 845 | 110 | * @see cx_list_default_insert_unique() |
| 111 | */ | |
| 870 | 112 | size_t (*insert_unique)(struct cx_list_s *list, const void *sorted_data, size_t n); |
| 845 | 113 | |
| 114 | /** | |
| 174 | 115 | * Member function for inserting an element relative to an iterator position. |
| 116 | */ | |
| 870 | 117 | int (*insert_iter)(struct cx_iterator_s *iter, const void *elem, int prepend); |
| 174 | 118 | |
| 119 | /** | |
| 440 | 120 | * Member function for removing elements. |
| 121 | * | |
| 122 | * Implementations SHALL check if @p targetbuf is set and copy the elements | |
| 123 | * to the buffer without invoking any destructor. | |
| 124 | * When @p targetbuf is not set, the destructors SHALL be invoked. | |
| 125 | * | |
| 126 | * The function SHALL return the actual number of elements removed, which | |
| 127 | * might be lower than @p num when going out of bounds. | |
| 174 | 128 | */ |
| 870 | 129 | size_t (*remove)(struct cx_list_s *list, size_t index, size_t num, void *targetbuf); |
| 174 | 130 | |
| 131 | /** | |
| 132 | * Member function for removing all elements. | |
| 133 | */ | |
| 134 | void (*clear)(struct cx_list_s *list); | |
| 135 | ||
| 136 | /** | |
| 137 | * Member function for swapping two elements. | |
| 440 | 138 | * |
| 324 | 139 | * @see cx_list_default_swap() |
| 174 | 140 | */ |
| 870 | 141 | int (*swap)(struct cx_list_s *list, size_t i, size_t j); |
| 174 | 142 | |
| 143 | /** | |
| 144 | * Member function for element lookup. | |
| 145 | */ | |
| 870 | 146 | void *(*at)(const struct cx_list_s *list, size_t index); |
| 174 | 147 | |
| 148 | /** | |
|
253
087cc9216f28
initial newapi GTK port
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
187
diff
changeset
|
149 | * Member function for finding and optionally removing an element. |
| 174 | 150 | */ |
| 870 | 151 | size_t (*find_remove)(struct cx_list_s *list, const void *elem, bool remove); |
| 174 | 152 | |
| 153 | /** | |
| 440 | 154 | * Member function for sorting the list. |
| 155 | * | |
| 324 | 156 | * @see cx_list_default_sort() |
| 174 | 157 | */ |
| 158 | void (*sort)(struct cx_list_s *list); | |
| 159 | ||
| 160 | /** | |
| 324 | 161 | * Optional member function for comparing this list |
| 162 | * to another list of the same type. | |
| 845 | 163 | * If set to @c NULL, the comparison won't be optimized. |
| 174 | 164 | */ |
| 870 | 165 | int (*compare)(const struct cx_list_s *list, const struct cx_list_s *other); |
| 174 | 166 | |
| 167 | /** | |
| 168 | * Member function for reversing the order of the items. | |
| 169 | */ | |
| 170 | void (*reverse)(struct cx_list_s *list); | |
| 171 | ||
| 172 | /** | |
|
943
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
173 | * Optional member function for changing the capacity. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
174 | * If the list does not support overallocation, this can be set to @c NULL. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
175 | */ |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
176 | int (*change_capacity)(struct cx_list_s *list, size_t new_capacity); |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
177 | |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
178 | /** |
| 174 | 179 | * Member function for returning an iterator pointing to the specified index. |
| 180 | */ | |
| 870 | 181 | struct cx_iterator_s (*iterator)(const struct cx_list_s *list, size_t index, bool backward); |
| 174 | 182 | }; |
| 183 | ||
| 184 | /** | |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
185 | * Common type for all list implementations. |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
186 | */ |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
187 | typedef struct cx_list_s CxList; |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
188 | |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
189 | /** |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
190 | * A shared instance of an empty list. |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
191 | * |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
192 | * Writing to that list is not allowed. |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
193 | * |
| 845 | 194 | * You can use this as a placeholder for initializing CxList pointers |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
195 | * for which you do not want to reserve memory right from the beginning. |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
196 | */ |
| 870 | 197 | CX_EXPORT extern CxList *const cxEmptyList; |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
198 | |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
199 | /** |
| 324 | 200 | * Default implementation of an array insert. |
| 201 | * | |
| 202 | * This function uses the element insert function for each element of the array. | |
| 203 | * | |
| 204 | * Use this in your own list class if you do not want to implement an optimized | |
| 205 | * version for your list. | |
| 206 | * | |
| 207 | * @param list the list | |
| 208 | * @param index the index where to insert the data | |
| 209 | * @param data a pointer to the array of data to insert | |
| 210 | * @param n the number of elements to insert | |
| 211 | * @return the number of elements actually inserted | |
| 212 | */ | |
| 440 | 213 | cx_attr_nonnull |
| 870 | 214 | CX_EXPORT size_t cx_list_default_insert_array(struct cx_list_s *list, |
| 215 | size_t index, const void *data, size_t n); | |
| 324 | 216 | |
| 217 | /** | |
| 218 | * Default implementation of a sorted insert. | |
| 219 | * | |
| 220 | * This function uses the array insert function to insert consecutive groups | |
| 221 | * of sorted data. | |
| 222 | * | |
| 440 | 223 | * The source data @em must already be sorted wrt. the list's compare function. |
| 324 | 224 | * |
| 225 | * Use this in your own list class if you do not want to implement an optimized | |
| 226 | * version for your list. | |
| 227 | * | |
| 228 | * @param list the list | |
| 229 | * @param sorted_data a pointer to the array of pre-sorted data to insert | |
| 230 | * @param n the number of elements to insert | |
| 231 | * @return the number of elements actually inserted | |
| 232 | */ | |
| 440 | 233 | cx_attr_nonnull |
| 870 | 234 | CX_EXPORT size_t cx_list_default_insert_sorted(struct cx_list_s *list, |
| 235 | const void *sorted_data, size_t n); | |
| 324 | 236 | |
| 237 | /** | |
| 845 | 238 | * Default implementation of an array insert where only elements are inserted when they don't exist in the list. |
| 239 | * | |
| 240 | * This function is similar to cx_list_default_insert_sorted(), except it skips elements that are already in the list. | |
| 241 | * | |
| 242 | * @note The return value of this function denotes the number of elements from the @p sorted_data that are definitely | |
| 243 | * contained in the list after completing the call. It is @em not the number of elements that were newly inserted. | |
| 244 | * That means, when no error occurred, the return value should be @p n. | |
| 245 | * | |
| 246 | * Use this in your own list class if you do not want to implement an optimized version for your list. | |
| 247 | * | |
| 248 | * @param list the list | |
| 249 | * @param sorted_data a pointer to the array of pre-sorted data to insert | |
| 250 | * @param n the number of elements to insert | |
| 251 | * @return the number of elements from the @p sorted_data that are definitely present in the list after this call | |
| 252 | */ | |
| 253 | cx_attr_nonnull | |
| 870 | 254 | CX_EXPORT size_t cx_list_default_insert_unique(struct cx_list_s *list, |
| 255 | const void *sorted_data, size_t n); | |
| 845 | 256 | |
| 257 | /** | |
| 324 | 258 | * Default unoptimized sort implementation. |
| 259 | * | |
| 260 | * This function will copy all data to an array, sort the array with standard | |
| 261 | * qsort, and then copy the data back to the list memory. | |
| 262 | * | |
| 263 | * Use this in your own list class if you do not want to implement an optimized | |
| 264 | * version for your list. | |
| 265 | * | |
| 266 | * @param list the list that shall be sorted | |
| 267 | */ | |
| 440 | 268 | cx_attr_nonnull |
| 870 | 269 | CX_EXPORT void cx_list_default_sort(struct cx_list_s *list); |
| 324 | 270 | |
| 271 | /** | |
| 272 | * Default unoptimized swap implementation. | |
| 273 | * | |
| 274 | * Use this in your own list class if you do not want to implement an optimized | |
| 275 | * version for your list. | |
| 276 | * | |
| 277 | * @param list the list in which to swap | |
| 278 | * @param i index of one element | |
| 279 | * @param j index of the other element | |
| 440 | 280 | * @retval zero success |
| 281 | * @retval non-zero when indices are out of bounds or memory | |
| 324 | 282 | * allocation for the temporary buffer fails |
| 283 | */ | |
| 440 | 284 | cx_attr_nonnull |
| 870 | 285 | CX_EXPORT int cx_list_default_swap(struct cx_list_s *list, size_t i, size_t j); |
| 324 | 286 | |
| 287 | /** | |
|
471
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
288 | * Initializes a list struct. |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
289 | * |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
290 | * Only use this function if you are creating your own list implementation. |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
291 | * The purpose of this function is to be called in the initialization code |
| 845 | 292 | * of your list to set certain members correctly. |
|
471
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
293 | * |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
294 | * This is particularly important when you want your list to support |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
295 | * #CX_STORE_POINTERS as @p elem_size. This function will wrap the list |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
296 | * class accordingly and make sure that you can implement your list as if |
| 845 | 297 | * it was only storing objects, and the wrapper will automatically enable |
|
471
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
298 | * the feature of storing pointers. |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
299 | * |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
300 | * @par Example |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
301 | * |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
302 | * @code |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
303 | * CxList *myCustomListCreate( |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
304 | * const CxAllocator *allocator, |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
305 | * cx_compare_func comparator, |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
306 | * size_t elem_size |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
307 | * ) { |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
308 | * if (allocator == NULL) { |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
309 | * allocator = cxDefaultAllocator; |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
310 | * } |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
311 | * |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
312 | * MyCustomList *list = cxCalloc(allocator, 1, sizeof(MyCustomList)); |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
313 | * if (list == NULL) return NULL; |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
314 | * |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
315 | * // initialize |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
316 | * cx_list_init((CxList*)list, &my_custom_list_class, |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
317 | * allocator, comparator, elem_size); |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
318 | * |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
319 | * // ... some more custom stuff ... |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
320 | * |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
321 | * return (CxList *) list; |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
322 | * } |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
323 | * @endcode |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
324 | * |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
325 | * @param list the list to initialize |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
326 | * @param cl the list class |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
327 | * @param allocator the allocator for the elements |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
328 | * @param comparator a compare function for the elements |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
329 | * @param elem_size the size of one element |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
330 | */ |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
331 | cx_attr_nonnull_arg(1, 2, 3) |
| 870 | 332 | CX_EXPORT void cx_list_init(struct cx_list_s *list, |
| 333 | struct cx_list_class_s *cl, const struct cx_allocator_s *allocator, | |
| 334 | cx_compare_func comparator, size_t elem_size); | |
|
471
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
335 | |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
336 | /** |
| 174 | 337 | * Returns the number of elements currently stored in the list. |
| 338 | * | |
| 339 | * @param list the list | |
| 340 | * @return the number of currently stored elements | |
| 341 | */ | |
| 440 | 342 | cx_attr_nonnull |
| 870 | 343 | CX_EXPORT size_t cxListSize(const CxList *list); |
| 174 | 344 | |
| 345 | /** | |
| 346 | * Adds an item to the end of the list. | |
| 347 | * | |
| 348 | * @param list the list | |
| 349 | * @param elem a pointer to the element to add | |
| 440 | 350 | * @retval zero success |
| 351 | * @retval non-zero memory allocation failure | |
| 174 | 352 | * @see cxListAddArray() |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
353 | * @see cxListEmplace() |
| 174 | 354 | */ |
| 440 | 355 | cx_attr_nonnull |
| 870 | 356 | CX_EXPORT int cxListAdd(CxList *list, const void *elem); |
| 174 | 357 | |
| 358 | /** | |
| 359 | * Adds multiple items to the end of the list. | |
| 360 | * | |
| 361 | * This method is more efficient than invoking cxListAdd() multiple times. | |
| 362 | * | |
| 363 | * If there is not enough memory to add all elements, the returned value is | |
| 440 | 364 | * less than @p n. |
| 174 | 365 | * |
| 845 | 366 | * If this list is storing pointers instead of objects, @p array is expected to |
| 174 | 367 | * be an array of pointers. |
| 368 | * | |
| 369 | * @param list the list | |
| 370 | * @param array a pointer to the elements to add | |
| 371 | * @param n the number of elements to add | |
| 372 | * @return the number of added elements | |
| 870 | 373 | * @see cxListEmplaceArray() |
| 174 | 374 | */ |
| 440 | 375 | cx_attr_nonnull |
| 870 | 376 | CX_EXPORT size_t cxListAddArray(CxList *list, const void *array, size_t n); |
| 174 | 377 | |
| 378 | /** | |
| 379 | * Inserts an item at the specified index. | |
| 380 | * | |
| 845 | 381 | * If the @p index equals the list @c size, this is effectively cxListAdd(). |
| 174 | 382 | * |
| 383 | * @param list the list | |
| 384 | * @param index the index the element shall have | |
| 385 | * @param elem a pointer to the element to add | |
| 440 | 386 | * @retval zero success |
| 387 | * @retval non-zero memory allocation failure or the index is out of bounds | |
| 174 | 388 | * @see cxListInsertAfter() |
| 389 | * @see cxListInsertBefore() | |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
390 | * @see cxListEmplaceAt() |
| 174 | 391 | */ |
| 440 | 392 | cx_attr_nonnull |
| 870 | 393 | CX_EXPORT int cxListInsert(CxList *list, size_t index, const void *elem); |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
394 | |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
395 | /** |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
396 | * Allocates memory for an element at the specified index and returns a pointer to that memory. |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
397 | * |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
398 | * @remark When the list is storing pointers, this will return a @c void**. |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
399 | * |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
400 | * @param list the list |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
401 | * @param index the index where to emplace the element |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
402 | * @return a pointer to the allocated memory; @c NULL when the operation fails, or the index is out-of-bounds |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
403 | * @see cxListEmplace() |
| 870 | 404 | * @see cxListEmplaceArrayAt() |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
405 | * @see cxListInsert() |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
406 | */ |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
407 | cx_attr_nonnull |
| 870 | 408 | CX_EXPORT void *cxListEmplaceAt(CxList *list, size_t index); |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
409 | |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
410 | /** |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
411 | * Allocates memory for an element at the end of the list and returns a pointer to that memory. |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
412 | * |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
413 | * @remark When the list is storing pointers, this will return a @c void**. |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
414 | * |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
415 | * @param list the list |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
416 | * @return a pointer to the allocated memory; @c NULL when the operation fails, or the index is out-of-bounds |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
417 | * @see cxListEmplaceAt() |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
418 | * @see cxListAdd() |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
419 | */ |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
420 | cx_attr_nonnull |
| 870 | 421 | CX_EXPORT void *cxListEmplace(CxList *list); |
| 422 | ||
| 423 | /** | |
| 424 | * Allocates memory for multiple elements and returns an iterator. | |
| 425 | * | |
| 426 | * The iterator will only iterate over the successfully allocated elements. | |
| 427 | * The @c elem_count attribute is set to that number, and the @c index attribute | |
| 428 | * will range from zero to @c elem_count minus one. | |
| 429 | * | |
| 430 | * @remark When the list is storing pointers, the iterator will iterate over | |
| 431 | * the @c void** elements. | |
| 432 | * | |
| 433 | * @param list the list | |
| 434 | * @param index the index where to insert the new data | |
| 435 | * @param n the number of elements for which to allocate the memory | |
| 436 | * @return an iterator, iterating over the new memory | |
| 437 | * @see cxListEmplaceAt() | |
| 438 | * @see cxListInsertArray() | |
| 439 | */ | |
| 440 | cx_attr_nonnull | |
| 441 | CX_EXPORT CxIterator cxListEmplaceArrayAt(CxList *list, size_t index, size_t n); | |
| 442 | ||
| 443 | /** | |
| 444 | * Allocates memory for multiple elements and returns an iterator. | |
| 445 | * | |
| 446 | * The iterator will only iterate over the successfully allocated elements. | |
| 447 | * The @c elem_count attribute is set to that number, and the @c index attribute | |
| 448 | * will range from zero to @c elem_count minus one. | |
| 449 | * | |
| 450 | * @remark When the list is storing pointers, the iterator will iterate over | |
| 451 | * the @c void** elements. | |
| 452 | * | |
| 453 | * @param list the list | |
| 454 | * @param n the number of elements for which to allocate the memory | |
| 455 | * @return an iterator, iterating over the new memory | |
| 456 | * @see cxListEmplace() | |
| 457 | * @see cxListAddArray() | |
| 458 | */ | |
| 459 | cx_attr_nonnull | |
| 460 | CX_EXPORT CxIterator cxListEmplaceArray(CxList *list, size_t n); | |
| 174 | 461 | |
| 462 | /** | |
| 324 | 463 | * Inserts an item into a sorted list. |
| 464 | * | |
|
471
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
465 | * If the list is not sorted already, the behavior is undefined. |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
466 | * |
| 324 | 467 | * @param list the list |
| 468 | * @param elem a pointer to the element to add | |
| 440 | 469 | * @retval zero success |
| 470 | * @retval non-zero memory allocation failure | |
| 324 | 471 | */ |
| 440 | 472 | cx_attr_nonnull |
| 870 | 473 | CX_EXPORT int cxListInsertSorted(CxList *list, const void *elem); |
| 324 | 474 | |
| 475 | /** | |
| 870 | 476 | * Inserts an item into a list if it does not exist. |
| 845 | 477 | * |
| 870 | 478 | * If the list is not sorted already, this function will check all elements |
| 479 | * and append the new element when it was not found. | |
| 480 | * It is strongly recommended to use this function only on sorted lists, where | |
| 481 | * the element, if it is not contained, is inserted at the correct position. | |
| 845 | 482 | * |
| 483 | * @param list the list | |
| 484 | * @param elem a pointer to the element to add | |
| 485 | * @retval zero success (also when the element was already in the list) | |
| 486 | * @retval non-zero memory allocation failure | |
| 487 | */ | |
| 488 | cx_attr_nonnull | |
| 870 | 489 | CX_EXPORT int cxListInsertUnique(CxList *list, const void *elem); |
| 845 | 490 | |
| 491 | /** | |
| 174 | 492 | * Inserts multiple items to the list at the specified index. |
| 845 | 493 | * If the @p index equals the list size, this is effectively cxListAddArray(). |
| 174 | 494 | * |
| 495 | * This method is usually more efficient than invoking cxListInsert() | |
| 496 | * multiple times. | |
| 497 | * | |
| 498 | * If there is not enough memory to add all elements, the returned value is | |
| 440 | 499 | * less than @p n. |
| 174 | 500 | * |
| 845 | 501 | * If this list is storing pointers instead of objects, @p array is expected to |
| 174 | 502 | * be an array of pointers. |
| 503 | * | |
| 504 | * @param list the list | |
| 505 | * @param index the index where to add the elements | |
| 506 | * @param array a pointer to the elements to add | |
| 507 | * @param n the number of elements to add | |
| 508 | * @return the number of added elements | |
| 870 | 509 | * @see cxListEmplaceArrayAt() |
| 174 | 510 | */ |
| 440 | 511 | cx_attr_nonnull |
| 870 | 512 | CX_EXPORT size_t cxListInsertArray(CxList *list, size_t index, const void *array, size_t n); |
| 174 | 513 | |
| 514 | /** | |
| 324 | 515 | * Inserts a sorted array into a sorted list. |
| 516 | * | |
| 845 | 517 | * This method is usually more efficient than inserting each element separately |
| 324 | 518 | * because consecutive chunks of sorted data are inserted in one pass. |
| 519 | * | |
| 520 | * If there is not enough memory to add all elements, the returned value is | |
| 440 | 521 | * less than @p n. |
| 324 | 522 | * |
| 845 | 523 | * If this list is storing pointers instead of objects, @p array is expected to |
| 324 | 524 | * be an array of pointers. |
| 525 | * | |
|
471
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
526 | * If the list is not sorted already, the behavior is undefined. |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
527 | * |
| 324 | 528 | * @param list the list |
| 529 | * @param array a pointer to the elements to add | |
| 530 | * @param n the number of elements to add | |
| 531 | * @return the number of added elements | |
| 532 | */ | |
| 440 | 533 | cx_attr_nonnull |
| 870 | 534 | CX_EXPORT size_t cxListInsertSortedArray(CxList *list, const void *array, size_t n); |
| 324 | 535 | |
| 536 | /** | |
| 870 | 537 | * Inserts an array into a list, skipping duplicates. |
| 538 | * | |
| 539 | * The @p list does not need to be sorted (in contrast to cxListInsertSortedArray()). | |
| 540 | * But it is strongly recommended to use this function only on sorted lists, | |
| 541 | * because otherwise it will fall back to an inefficient algorithm which inserts | |
| 542 | * all elements one by one. | |
| 543 | * If the @p list is not sorted, the @p array also does not need to be sorted. | |
| 544 | * But when the @p list is sorted, the @p array must also be sorted. | |
| 845 | 545 | * |
| 546 | * This method is usually more efficient than inserting each element separately | |
| 547 | * because consecutive chunks of sorted data are inserted in one pass. | |
| 548 | * | |
| 549 | * If there is not enough memory to add all elements, the returned value is | |
| 550 | * less than @p n. | |
| 551 | * | |
| 552 | * @note The return value of this function denotes the number of elements | |
| 553 | * from the @p sorted_data that are definitely contained in the list after | |
| 554 | * completing the call. It is @em not the number of elements that were newly | |
| 555 | * inserted. That means, when no error occurred, the return value should | |
| 556 | * be @p n. | |
| 557 | * | |
| 558 | * If this list is storing pointers instead of objects @p array is expected to | |
| 559 | * be an array of pointers. | |
| 560 | * | |
| 561 | * @param list the list | |
| 562 | * @param array a pointer to the elements to add | |
| 563 | * @param n the number of elements to add | |
| 564 | * @return the number of added elements | |
| 565 | * | |
| 566 | * @return the number of elements from the @p sorted_data that are definitely present in the list after this call | |
| 567 | */ | |
| 568 | cx_attr_nonnull | |
| 870 | 569 | CX_EXPORT size_t cxListInsertUniqueArray(CxList *list, const void *array, size_t n); |
| 845 | 570 | |
| 571 | /** | |
| 174 | 572 | * Inserts an element after the current location of the specified iterator. |
| 573 | * | |
| 574 | * The used iterator remains operational, but all other active iterators should | |
| 575 | * be considered invalidated. | |
| 576 | * | |
| 440 | 577 | * If @p iter is not a list iterator, the behavior is undefined. |
| 578 | * If @p iter is a past-the-end iterator, the new element gets appended to the list. | |
| 174 | 579 | * |
| 580 | * @param iter an iterator | |
| 581 | * @param elem the element to insert | |
| 440 | 582 | * @retval zero success |
| 583 | * @retval non-zero memory allocation failure | |
| 174 | 584 | * @see cxListInsert() |
| 585 | * @see cxListInsertBefore() | |
| 586 | */ | |
| 440 | 587 | cx_attr_nonnull |
| 870 | 588 | CX_EXPORT int cxListInsertAfter(CxIterator *iter, const void *elem); |
| 174 | 589 | |
| 590 | /** | |
| 591 | * Inserts an element before the current location of the specified iterator. | |
| 592 | * | |
| 593 | * The used iterator remains operational, but all other active iterators should | |
| 594 | * be considered invalidated. | |
| 595 | * | |
| 440 | 596 | * If @p iter is not a list iterator, the behavior is undefined. |
| 597 | * If @p iter is a past-the-end iterator, the new element gets appended to the list. | |
| 174 | 598 | * |
| 599 | * @param iter an iterator | |
| 600 | * @param elem the element to insert | |
| 440 | 601 | * @retval zero success |
| 602 | * @retval non-zero memory allocation failure | |
| 174 | 603 | * @see cxListInsert() |
| 604 | * @see cxListInsertAfter() | |
| 605 | */ | |
| 440 | 606 | cx_attr_nonnull |
| 870 | 607 | CX_EXPORT int cxListInsertBefore(CxIterator *iter, const void *elem); |
| 174 | 608 | |
| 609 | /** | |
| 610 | * Removes the element at the specified index. | |
| 611 | * | |
| 612 | * If an element destructor function is specified, it is called before | |
| 613 | * removing the element. | |
| 614 | * | |
| 615 | * @param list the list | |
| 616 | * @param index the index of the element | |
| 440 | 617 | * @retval zero success |
| 618 | * @retval non-zero index out of bounds | |
| 174 | 619 | */ |
| 440 | 620 | cx_attr_nonnull |
| 870 | 621 | CX_EXPORT int cxListRemove(CxList *list, size_t index); |
| 440 | 622 | |
| 623 | /** | |
| 624 | * Removes and returns the element at the specified index. | |
| 625 | * | |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
626 | * No destructor is called, and instead the element is copied to the |
| 440 | 627 | * @p targetbuf which MUST be large enough to hold the removed element. |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
628 | * If the list is storing pointers, only the pointer is copied to @p targetbuf. |
| 440 | 629 | * |
| 630 | * @param list the list | |
| 631 | * @param index the index of the element | |
| 632 | * @param targetbuf a buffer where to copy the element | |
| 633 | * @retval zero success | |
| 634 | * @retval non-zero index out of bounds | |
| 635 | */ | |
| 870 | 636 | cx_attr_nonnull cx_attr_access_w(3) |
| 637 | CX_EXPORT int cxListRemoveAndGet(CxList *list, size_t index, void *targetbuf); | |
| 440 | 638 | |
| 639 | /** | |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
640 | * Removes and returns the first element of the list. |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
641 | * |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
642 | * No destructor is called, and instead the element is copied to the |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
643 | * @p targetbuf which MUST be large enough to hold the removed element. |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
644 | * If the list is storing pointers, only the pointer is copied to @p targetbuf. |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
645 | * |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
646 | * @param list the list |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
647 | * @param targetbuf a buffer where to copy the element |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
648 | * @retval zero success |
| 845 | 649 | * @retval non-zero the list is empty |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
650 | * @see cxListPopFront() |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
651 | * @see cxListRemoveAndGetLast() |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
652 | */ |
| 870 | 653 | cx_attr_nonnull cx_attr_access_w(2) |
| 654 | CX_EXPORT int cxListRemoveAndGetFirst(CxList *list, void *targetbuf); | |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
655 | |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
656 | /** |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
657 | * Removes and returns the first element of the list. |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
658 | * |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
659 | * Alias for cxListRemoveAndGetFirst(). |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
660 | * |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
661 | * No destructor is called, and instead the element is copied to the |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
662 | * @p targetbuf which MUST be large enough to hold the removed element. |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
663 | * If the list is storing pointers, only the pointer is copied to @p targetbuf. |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
664 | * |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
665 | * @param list (@c CxList*) the list |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
666 | * @param targetbuf (@c void*) a buffer where to copy the element |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
667 | * @retval zero success |
| 845 | 668 | * @retval non-zero the list is empty |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
669 | * @see cxListRemoveAndGetFirst() |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
670 | * @see cxListPop() |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
671 | */ |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
672 | #define cxListPopFront(list, targetbuf) cxListRemoveAndGetFirst((list), (targetbuf)) |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
673 | |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
674 | |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
675 | /** |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
676 | * Removes and returns the last element of the list. |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
677 | * |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
678 | * No destructor is called, and instead the element is copied to the |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
679 | * @p targetbuf which MUST be large enough to hold the removed element. |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
680 | * If the list is storing pointers, only the pointer is copied to @p targetbuf. |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
681 | * |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
682 | * @param list the list |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
683 | * @param targetbuf a buffer where to copy the element |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
684 | * @retval zero success |
| 845 | 685 | * @retval non-zero the list is empty |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
686 | */ |
| 870 | 687 | cx_attr_nonnull cx_attr_access_w(2) |
| 688 | CX_EXPORT int cxListRemoveAndGetLast(CxList *list, void *targetbuf); | |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
689 | |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
690 | /** |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
691 | * Removes and returns the last element of the list. |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
692 | * |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
693 | * Alias for cxListRemoveAndGetLast(). |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
694 | * |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
695 | * No destructor is called, and instead the element is copied to the |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
696 | * @p targetbuf which MUST be large enough to hold the removed element. |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
697 | * If the list is storing pointers, only the pointer is copied to @p targetbuf. |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
698 | * |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
699 | * @param list (@c CxList*) the list |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
700 | * @param targetbuf (@c void*) a buffer where to copy the element |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
701 | * @retval zero success |
| 845 | 702 | * @retval non-zero the list is empty |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
703 | * @see cxListRemoveAndGetLast() |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
704 | * @see cxListPopFront() |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
705 | */ |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
706 | #define cxListPop(list, targetbuf) cxListRemoveAndGetLast((list), (targetbuf)) |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
707 | |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
708 | /** |
| 440 | 709 | * Removes multiple element starting at the specified index. |
| 710 | * | |
| 711 | * If an element destructor function is specified, it is called for each | |
| 712 | * element. It is guaranteed that the destructor is called before removing | |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
713 | * the element. However, due to possible optimizations, it is neither guaranteed |
| 440 | 714 | * that the destructors are invoked for all elements before starting to remove |
| 715 | * them, nor that the element is removed immediately after the destructor call | |
| 716 | * before proceeding to the next element. | |
| 717 | * | |
| 718 | * @param list the list | |
| 719 | * @param index the index of the element | |
| 720 | * @param num the number of elements to remove | |
| 721 | * @return the actual number of removed elements | |
| 722 | */ | |
| 723 | cx_attr_nonnull | |
| 870 | 724 | CX_EXPORT size_t cxListRemoveArray(CxList *list, size_t index, size_t num); |
| 440 | 725 | |
| 726 | /** | |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
727 | * Removes and returns multiple elements starting at the specified index. |
| 440 | 728 | * |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
729 | * No destructor is called, and instead the elements are copied to the |
| 440 | 730 | * @p targetbuf which MUST be large enough to hold all removed elements. |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
731 | * If the list is storing pointers, @p targetbuf is expected to be an array of pointers. |
| 440 | 732 | * |
| 733 | * @param list the list | |
| 734 | * @param index the index of the element | |
| 735 | * @param num the number of elements to remove | |
| 736 | * @param targetbuf a buffer where to copy the elements | |
| 737 | * @return the actual number of removed elements | |
| 738 | */ | |
| 870 | 739 | cx_attr_nonnull cx_attr_access_w(4) |
| 740 | CX_EXPORT size_t cxListRemoveArrayAndGet(CxList *list, size_t index, size_t num, void *targetbuf); | |
| 174 | 741 | |
| 742 | /** | |
| 743 | * Removes all elements from this list. | |
| 744 | * | |
| 440 | 745 | * If element destructor functions are specified, they are called for each |
| 174 | 746 | * element before removing them. |
| 747 | * | |
| 748 | * @param list the list | |
| 749 | */ | |
| 440 | 750 | cx_attr_nonnull |
| 870 | 751 | CX_EXPORT void cxListClear(CxList *list); |
| 174 | 752 | |
| 753 | /** | |
| 754 | * Swaps two items in the list. | |
| 755 | * | |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
756 | * Implementations should only allocate temporary memory for the swap if |
| 174 | 757 | * it is necessary. |
| 758 | * | |
| 759 | * @param list the list | |
| 760 | * @param i the index of the first element | |
| 761 | * @param j the index of the second element | |
| 440 | 762 | * @retval zero success |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
763 | * @retval non-zero one of the indices is out of bounds, |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
764 | * or the swap needed extra memory, but allocation failed |
| 174 | 765 | */ |
| 440 | 766 | cx_attr_nonnull |
| 870 | 767 | CX_EXPORT int cxListSwap(CxList *list, size_t i, size_t j); |
| 174 | 768 | |
| 769 | /** | |
| 770 | * Returns a pointer to the element at the specified index. | |
| 771 | * | |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
772 | * If the list is storing pointers, returns the pointer stored at the specified index. |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
773 | * |
| 174 | 774 | * @param list the list |
| 775 | * @param index the index of the element | |
| 440 | 776 | * @return a pointer to the element or @c NULL if the index is out of bounds |
| 174 | 777 | */ |
| 440 | 778 | cx_attr_nonnull |
| 870 | 779 | CX_EXPORT void *cxListAt(const CxList *list, size_t index); |
| 174 | 780 | |
| 781 | /** | |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
782 | * Returns a pointer to the first element. |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
783 | * |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
784 | * If the list is storing pointers, returns the first pointer stored in the list. |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
785 | * |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
786 | * @param list the list |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
787 | * @return a pointer to the first element or @c NULL if the list is empty |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
788 | */ |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
789 | cx_attr_nonnull |
| 870 | 790 | CX_EXPORT void *cxListFirst(const CxList *list); |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
791 | |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
792 | /** |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
793 | * Returns a pointer to the last element. |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
794 | * |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
795 | * If the list is storing pointers, returns the last pointer stored in the list. |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
796 | * |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
797 | * @param list the list |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
798 | * @return a pointer to the last element or @c NULL if the list is empty |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
799 | */ |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
800 | cx_attr_nonnull |
| 870 | 801 | CX_EXPORT void *cxListLast(const CxList *list); |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
802 | |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
803 | /** |
| 870 | 804 | * Sets the element at the specified index in the list. |
| 805 | * | |
| 806 | * This overwrites the element in-place without calling any destructor | |
| 807 | * on the overwritten element. | |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
808 | * |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
809 | * @param list the list to set the element in |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
810 | * @param index the index to set the element at |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
811 | * @param elem element to set |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
812 | * @retval zero on success |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
813 | * @retval non-zero when index is out of bounds |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
814 | */ |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
815 | cx_attr_nonnull |
| 870 | 816 | CX_EXPORT int cxListSet(CxList *list, size_t index, const void *elem); |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
817 | |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
818 | /** |
| 174 | 819 | * Returns an iterator pointing to the item at the specified index. |
| 820 | * | |
| 821 | * The returned iterator is position-aware. | |
| 822 | * | |
| 845 | 823 | * If the index is out of range or @p list is @c NULL, a past-the-end iterator will be returned. |
| 174 | 824 | * |
| 825 | * @param list the list | |
| 826 | * @param index the index where the iterator shall point at | |
| 827 | * @return a new iterator | |
| 828 | */ | |
| 440 | 829 | cx_attr_nodiscard |
| 870 | 830 | CX_EXPORT CxIterator cxListIteratorAt(const CxList *list, size_t index); |
| 174 | 831 | |
| 832 | /** | |
| 833 | * Returns a backwards iterator pointing to the item at the specified index. | |
| 834 | * | |
| 835 | * The returned iterator is position-aware. | |
| 836 | * | |
| 845 | 837 | * If the index is out of range or @p list is @c NULL, a past-the-end iterator will be returned. |
| 174 | 838 | * |
| 839 | * @param list the list | |
| 840 | * @param index the index where the iterator shall point at | |
| 841 | * @return a new iterator | |
| 842 | */ | |
| 440 | 843 | cx_attr_nodiscard |
| 870 | 844 | CX_EXPORT CxIterator cxListBackwardsIteratorAt(const CxList *list, size_t index); |
| 174 | 845 | |
| 846 | /** | |
| 847 | * Returns an iterator pointing to the first item of the list. | |
| 848 | * | |
| 849 | * The returned iterator is position-aware. | |
| 850 | * | |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
851 | * If the list is empty or @c NULL, a past-the-end iterator will be returned. |
| 174 | 852 | * |
| 853 | * @param list the list | |
| 854 | * @return a new iterator | |
| 855 | */ | |
| 440 | 856 | cx_attr_nodiscard |
| 870 | 857 | CX_EXPORT CxIterator cxListIterator(const CxList *list); |
| 174 | 858 | |
| 859 | /** | |
| 860 | * Returns a backwards iterator pointing to the last item of the list. | |
| 861 | * | |
| 862 | * The returned iterator is position-aware. | |
| 863 | * | |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
864 | * If the list is empty or @c NULL, a past-the-end iterator will be returned. |
| 174 | 865 | * |
| 866 | * @param list the list | |
| 867 | * @return a new iterator | |
| 868 | */ | |
| 440 | 869 | cx_attr_nodiscard |
| 870 | 870 | CX_EXPORT CxIterator cxListBackwardsIterator(const CxList *list); |
| 174 | 871 | |
| 872 | /** | |
| 440 | 873 | * Returns the index of the first element that equals @p elem. |
| 174 | 874 | * |
| 875 | * Determining equality is performed by the list's comparator function. | |
| 876 | * | |
| 877 | * @param list the list | |
| 878 | * @param elem the element to find | |
|
471
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
879 | * @return the index of the element or the size of the list when the element is not found |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
880 | * @see cxListIndexValid() |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
881 | * @see cxListContains() |
| 174 | 882 | */ |
| 870 | 883 | cx_attr_nonnull cx_attr_nodiscard |
| 884 | CX_EXPORT size_t cxListFind(const CxList *list, const void *elem); | |
|
253
087cc9216f28
initial newapi GTK port
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
187
diff
changeset
|
885 | |
|
087cc9216f28
initial newapi GTK port
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
187
diff
changeset
|
886 | /** |
| 845 | 887 | * Checks if the list contains the specified element. |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
888 | * |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
889 | * The elements are compared with the list's comparator function. |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
890 | * |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
891 | * @param list the list |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
892 | * @param elem the element to find |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
893 | * @retval true if the element is contained |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
894 | * @retval false if the element is not contained |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
895 | * @see cxListFind() |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
896 | */ |
| 870 | 897 | cx_attr_nonnull cx_attr_nodiscard |
| 898 | CX_EXPORT bool cxListContains(const CxList* list, const void* elem); | |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
899 | |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
900 | /** |
|
471
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
901 | * Checks if the specified index is within bounds. |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
902 | * |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
903 | * @param list the list |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
904 | * @param index the index |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
905 | * @retval true if the index is within bounds |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
906 | * @retval false if the index is out of bounds |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
907 | */ |
| 870 | 908 | cx_attr_nonnull cx_attr_nodiscard |
| 909 | CX_EXPORT bool cxListIndexValid(const CxList *list, size_t index); | |
|
471
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
910 | |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
911 | /** |
| 440 | 912 | * Removes and returns the index of the first element that equals @p elem. |
|
253
087cc9216f28
initial newapi GTK port
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
187
diff
changeset
|
913 | * |
|
087cc9216f28
initial newapi GTK port
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
187
diff
changeset
|
914 | * Determining equality is performed by the list's comparator function. |
|
087cc9216f28
initial newapi GTK port
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
187
diff
changeset
|
915 | * |
|
087cc9216f28
initial newapi GTK port
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
187
diff
changeset
|
916 | * @param list the list |
|
087cc9216f28
initial newapi GTK port
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
187
diff
changeset
|
917 | * @param elem the element to find and remove |
|
471
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
918 | * @return the index of the now removed element or the list size |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
919 | * when the element is not found or could not be removed |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
920 | * @see cxListIndexValid() |
|
253
087cc9216f28
initial newapi GTK port
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
187
diff
changeset
|
921 | */ |
| 440 | 922 | cx_attr_nonnull |
| 870 | 923 | CX_EXPORT size_t cxListFindRemove(CxList *list, const void *elem); |
| 174 | 924 | |
| 925 | /** | |
| 440 | 926 | * Sorts the list. |
| 174 | 927 | * |
| 440 | 928 | * @remark The underlying sort algorithm is implementation defined. |
| 174 | 929 | * |
| 930 | * @param list the list | |
| 931 | */ | |
| 440 | 932 | cx_attr_nonnull |
| 870 | 933 | CX_EXPORT void cxListSort(CxList *list); |
| 174 | 934 | |
| 935 | /** | |
| 936 | * Reverses the order of the items. | |
| 937 | * | |
| 938 | * @param list the list | |
| 939 | */ | |
| 440 | 940 | cx_attr_nonnull |
| 870 | 941 | CX_EXPORT void cxListReverse(CxList *list); |
| 174 | 942 | |
| 943 | /** | |
| 944 | * Compares a list to another list of the same type. | |
| 945 | * | |
| 946 | * First, the list sizes are compared. | |
| 947 | * If they match, the lists are compared element-wise. | |
| 948 | * | |
| 949 | * @param list the list | |
| 950 | * @param other the list to compare to | |
| 440 | 951 | * @retval zero both lists are equal element wise |
| 870 | 952 | * @retval negative the first list is smaller, |
| 440 | 953 | * or the first non-equal element in the first list is smaller |
| 954 | * @retval positive the first list is larger | |
| 955 | * or the first non-equal element in the first list is larger | |
| 174 | 956 | */ |
| 870 | 957 | cx_attr_nonnull cx_attr_nodiscard |
| 958 | CX_EXPORT int cxListCompare(const CxList *list, const CxList *other); | |
| 174 | 959 | |
| 960 | /** | |
| 961 | * Deallocates the memory of the specified list structure. | |
| 962 | * | |
| 440 | 963 | * Also calls the content destructor functions for each element, if specified. |
| 174 | 964 | * |
| 845 | 965 | * @param list the list that shall be freed |
| 174 | 966 | */ |
| 870 | 967 | CX_EXPORT void cxListFree(CxList *list); |
| 174 | 968 | |
| 969 | ||
|
943
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
970 | /** |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
971 | * Performs a deep clone of one list into another. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
972 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
973 | * If the destination list already contains elements, the cloned elements |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
974 | * are appended to that list. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
975 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
976 | * @attention If the cloned elements need to be destroyed by a destructor |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
977 | * function, you must make sure that the destination list also uses this |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
978 | * destructor function. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
979 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
980 | * @param dst the destination list |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
981 | * @param src the source list |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
982 | * @param clone_func the clone function for the elements |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
983 | * @param clone_allocator the allocator that is passed to the clone function |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
984 | * @param data optional additional data that is passed to the clone function |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
985 | * @retval zero when all elements were successfully cloned |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
986 | * @retval non-zero when an allocation error occurred |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
987 | * @see cxListCloneSimple() |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
988 | */ |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
989 | cx_attr_nonnull_arg(1, 2, 3) |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
990 | CX_EXPORT int cxListClone(CxList *dst, const CxList *src, |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
991 | cx_clone_func clone_func, const CxAllocator *clone_allocator, void *data); |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
992 | |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
993 | /** |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
994 | * Clones elements from a list only if they are not present in another list. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
995 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
996 | * If the @p minuend does not contain duplicates, this is equivalent to adding |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
997 | * the set difference to the destination list. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
998 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
999 | * This function is optimized for the case when both the @p minuend and the |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1000 | * @p subtrahend are sorted. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1001 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1002 | * @param dst the destination list |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1003 | * @param minuend the list to subtract elements from |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1004 | * @param subtrahend the elements that shall be subtracted |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1005 | * @param clone_func the clone function for the elements |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1006 | * @param clone_allocator the allocator that is passed to the clone function |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1007 | * @param data optional additional data that is passed to the clone function |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1008 | * @retval zero when the elements were successfully cloned |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1009 | * @retval non-zero when an allocation error occurred |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1010 | * @see cxListDifferenceSimple() |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1011 | */ |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1012 | cx_attr_nonnull_arg(1, 2, 3, 4) |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1013 | CX_EXPORT int cxListDifference(CxList *dst, |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1014 | const CxList *minuend, const CxList *subtrahend, |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1015 | cx_clone_func clone_func, const CxAllocator *clone_allocator, void *data); |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1016 | |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1017 | /** |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1018 | * Clones elements from a list only if they are also present in another list. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1019 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1020 | * This function is optimized for the case when both the @p src and the |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1021 | * @p other list are sorted. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1022 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1023 | * If the destination list already contains elements, the intersection is appended |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1024 | * to that list. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1025 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1026 | * @param dst the destination list |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1027 | * @param src the list to clone the elements from |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1028 | * @param other the list to check the elements for existence |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1029 | * @param clone_func the clone function for the elements |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1030 | * @param clone_allocator the allocator that is passed to the clone function |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1031 | * @param data optional additional data that is passed to the clone function |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1032 | * @retval zero when the elements were successfully cloned |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1033 | * @retval non-zero when an allocation error occurred |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1034 | * @see cxListIntersectionSimple() |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1035 | */ |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1036 | cx_attr_nonnull_arg(1, 2, 3, 4) |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1037 | CX_EXPORT int cxListIntersection(CxList *dst, const CxList *src, const CxList *other, |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1038 | cx_clone_func clone_func, const CxAllocator *clone_allocator, void *data); |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1039 | |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1040 | /** |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1041 | * Performs a deep clone of one list into another, skipping duplicates. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1042 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1043 | * This function is optimized for the case when both the @p src and the |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1044 | * @p other list are sorted. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1045 | * In that case, the union will also be sorted. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1046 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1047 | * If the destination list already contains elements, the union is appended |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1048 | * to that list. In that case the destination is not necessarily sorted. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1049 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1050 | * @param dst the destination list |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1051 | * @param src the primary source list |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1052 | * @param other the other list, where elements are only cloned from |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1053 | * when they are not in @p src |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1054 | * @param clone_func the clone function for the elements |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1055 | * @param clone_allocator the allocator that is passed to the clone function |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1056 | * @param data optional additional data that is passed to the clone function |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1057 | * @retval zero when the elements were successfully cloned |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1058 | * @retval non-zero when an allocation error occurred |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1059 | * @see cxListUnionSimple() |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1060 | */ |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1061 | cx_attr_nonnull_arg(1, 2, 3, 4) |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1062 | CX_EXPORT int cxListUnion(CxList *dst, const CxList *src, const CxList *other, |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1063 | cx_clone_func clone_func, const CxAllocator *clone_allocator, void *data); |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1064 | |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1065 | /** |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1066 | * Performs a shallow clone of one list into another. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1067 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1068 | * This function uses the default allocator, if needed, and performs |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1069 | * shallow clones with @c memcpy(). |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1070 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1071 | * If the destination list already contains elements, the cloned elements |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1072 | * are appended to that list. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1073 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1074 | * @attention If the cloned elements need to be destroyed by a destructor |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1075 | * function, you must make sure that the destination list also uses this |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1076 | * destructor function. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1077 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1078 | * @param dst the destination list |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1079 | * @param src the source list |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1080 | * @retval zero when all elements were successfully cloned |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1081 | * @retval non-zero when an allocation error occurred |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1082 | * @see cxListClone() |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1083 | */ |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1084 | cx_attr_nonnull |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1085 | CX_EXPORT int cxListCloneSimple(CxList *dst, const CxList *src); |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1086 | |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1087 | /** |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1088 | * Clones elements from a list only if they are not present in another list. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1089 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1090 | * This function uses the default allocator, if needed, and performs |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1091 | * shallow clones with @c memcpy(). |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1092 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1093 | * If the @p minuend does not contain duplicates, this is equivalent to adding |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1094 | * the set difference to the destination list. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1095 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1096 | * This function is optimized for the case when both the @p minuend and the |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1097 | * @p subtrahend are sorted. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1098 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1099 | * @param dst the destination list |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1100 | * @param minuend the list to subtract elements from |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1101 | * @param subtrahend the elements that shall be subtracted |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1102 | * @retval zero when the elements were successfully cloned |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1103 | * @retval non-zero when an allocation error occurred |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1104 | * @see cxListDifference() |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1105 | */ |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1106 | cx_attr_nonnull |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1107 | CX_EXPORT int cxListDifferenceSimple(CxList *dst, |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1108 | const CxList *minuend, const CxList *subtrahend); |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1109 | |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1110 | /** |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1111 | * Clones elements from a list only if they are also present in another list. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1112 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1113 | * This function uses the default allocator, if needed, and performs |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1114 | * shallow clones with @c memcpy(). |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1115 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1116 | * This function is optimized for the case when both the @p src and the |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1117 | * @p other list are sorted. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1118 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1119 | * If the destination list already contains elements, the intersection is appended |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1120 | * to that list. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1121 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1122 | * @param dst the destination list |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1123 | * @param src the list to clone the elements from |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1124 | * @param other the list to check the elements for existence |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1125 | * @retval zero when the elements were successfully cloned |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1126 | * @retval non-zero when an allocation error occurred |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1127 | * @see cxListIntersection() |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1128 | */ |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1129 | cx_attr_nonnull |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1130 | CX_EXPORT int cxListIntersectionSimple(CxList *dst, const CxList *src, const CxList *other); |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1131 | |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1132 | /** |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1133 | * Performs a deep clone of one list into another, skipping duplicates. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1134 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1135 | * This function uses the default allocator, if needed, and performs |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1136 | * shallow clones with @c memcpy(). |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1137 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1138 | * This function is optimized for the case when both the @p src and the |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1139 | * @p other list are sorted. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1140 | * In that case, the union will also be sorted. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1141 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1142 | * If the destination list already contains elements, the union is appended |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1143 | * to that list. In that case the destination is not necessarily sorted. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1144 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1145 | * @param dst the destination list |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1146 | * @param src the primary source list |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1147 | * @param other the other list, where elements are only cloned from |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1148 | * when they are not in @p src |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1149 | * @retval zero when the elements were successfully cloned |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1150 | * @retval non-zero when an allocation error occurred |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1151 | * @see cxListUnion() |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1152 | */ |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1153 | cx_attr_nonnull |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1154 | CX_EXPORT int cxListUnionSimple(CxList *dst, const CxList *src, const CxList *other); |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1155 | |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1156 | /** |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1157 | * Asks the list to reserve enough memory for a given total number of elements. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1158 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1159 | * List implementations are free to choose if reserving memory upfront makes |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1160 | * sense. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1161 | * For example, array-based implementations usually do support reserving memory |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1162 | * for additional elements while linked lists usually don't. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1163 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1164 | * @note When the requested capacity is smaller than the current size, |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1165 | * this function returns zero without performing any action. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1166 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1167 | * @param list the list |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1168 | * @param capacity the expected total number of elements |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1169 | * @retval zero on success or when overallocation is not supported |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1170 | * @retval non-zero when an allocation error occurred |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1171 | * @see cxListShrink() |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1172 | */ |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1173 | cx_attr_nonnull |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1174 | CX_EXPORT int cxListReserve(CxList *list, size_t capacity); |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1175 | |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1176 | /** |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1177 | * Advises the list to free any overallocated memory. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1178 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1179 | * Lists that do not support overallocation simply return zero. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1180 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1181 | * This function usually returns zero, except for very special and custom |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1182 | * list and/or allocator implementations where freeing memory can fail. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1183 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1184 | * @param list the list |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1185 | * @return usually zero |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1186 | */ |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1187 | cx_attr_nonnull |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1188 | CX_EXPORT int cxListShrink(CxList *list); |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1189 | |
| 174 | 1190 | #ifdef __cplusplus |
| 1191 | } // extern "C" | |
| 1192 | #endif | |
| 1193 | ||
| 1194 | #endif // UCX_LIST_H |