207 * Adds an item to the end of the list. |
216 * Adds an item to the end of the list. |
208 * |
217 * |
209 * @param list the list |
218 * @param list the list |
210 * @param elem a pointer to the element to add |
219 * @param elem a pointer to the element to add |
211 * @return zero on success, non-zero on memory allocation failure |
220 * @return zero on success, non-zero on memory allocation failure |
|
221 * @see cxListAddArray() |
212 */ |
222 */ |
213 __attribute__((__nonnull__)) |
223 __attribute__((__nonnull__)) |
214 static inline int cxListAdd( |
224 static inline int cxListAdd( |
215 CxList *list, |
225 CxList *list, |
216 void const *elem |
226 void const *elem |
217 ) { |
227 ) { |
218 return list->cl->add(list, elem); |
228 return list->cl->add(list, elem); |
|
229 } |
|
230 |
|
231 /** |
|
232 * Adds multiple items to the end of the list. |
|
233 * |
|
234 * This method is more efficient than invoking cxListAdd() multiple times. |
|
235 * |
|
236 * If there is not enough memory to add all elements, the returned value is |
|
237 * less than \p n. |
|
238 * |
|
239 * @param list the list |
|
240 * @param array a pointer to the elements to add |
|
241 * @param n the number of elements to add |
|
242 * @return the number of added elements |
|
243 */ |
|
244 __attribute__((__nonnull__)) |
|
245 static inline size_t cxListAddArray( |
|
246 CxList *list, |
|
247 void const *array, |
|
248 size_t n |
|
249 ) { |
|
250 return list->cl->add_array(list, array, n); |
219 } |
251 } |
220 |
252 |
221 /** |
253 /** |
222 * Inserts an item at the specified index. |
254 * Inserts an item at the specified index. |
223 * |
255 * |