ucx/list.h

changeset 125
fca8efb122de
parent 124
8b44653541ef
child 126
dffb551c5f18
equal deleted inserted replaced
124:8b44653541ef 125:fca8efb122de
35 35
36 #ifndef UCX_LIST_H 36 #ifndef UCX_LIST_H
37 #define UCX_LIST_H 37 #define UCX_LIST_H
38 38
39 #include "ucx.h" 39 #include "ucx.h"
40 #include "allocator.h"
40 #include <stddef.h> 41 #include <stddef.h>
41 42
42 #ifdef __cplusplus 43 #ifdef __cplusplus
43 extern "C" { 44 extern "C" {
44 #endif 45 #endif
79 * the first element. 80 * the first element.
80 */ 81 */
81 UcxList *prev; 82 UcxList *prev;
82 }; 83 };
83 84
84 UcxList *ucx_list_clone(UcxList *l, copy_func fnc, void* data); 85 UcxList *ucx_list_clone(UcxList *list, copy_func cpyfnc, void* data);
86 UcxList *ucx_list_clone_a(UcxAllocator *allocator, UcxList *list,
87 copy_func cpyfnc, void* data);
85 88
86 /** 89 /**
87 * Compares two UCX lists element-wise by using a compare function. 90 * Compares two UCX lists element-wise by using a compare function.
88 * 91 *
89 * Each element of the two specified lists are compared by using the specified 92 * Each element of the two specified lists are compared by using the specified
114 * to ucx_list_first() on the argument must return the argument itself) 117 * to ucx_list_first() on the argument must return the argument itself)
115 * 118 *
116 * @param list The list to free. 119 * @param list The list to free.
117 */ 120 */
118 void ucx_list_free(UcxList *list); 121 void ucx_list_free(UcxList *list);
122 void ucx_list_free_a(UcxAllocator *allocator, UcxList *list);
119 UcxList *ucx_list_append(UcxList *list, void *data); 123 UcxList *ucx_list_append(UcxList *list, void *data);
124 UcxList *ucx_list_append_a(UcxAllocator *allocator, UcxList *list, void *data);
120 UcxList *ucx_list_prepend(UcxList *list, void *data); 125 UcxList *ucx_list_prepend(UcxList *list, void *data);
126 UcxList *ucx_list_prepend_a(UcxAllocator *allocator, UcxList *list, void *data);
121 UcxList *ucx_list_concat(UcxList *list1, UcxList *list2); 127 UcxList *ucx_list_concat(UcxList *list1, UcxList *list2);
122 /** 128 /**
123 * Returns the first element of a list. 129 * Returns the first element of a list.
124 * 130 *
125 * If the argument is the list pointer, it is directly returned. Otherwise 131 * If the argument is the list pointer, it is directly returned. Otherwise
160 * @param element the element to removed 166 * @param element the element to removed
161 * @return returns the updated list pointer or <code>NULL</code>, if the list 167 * @return returns the updated list pointer or <code>NULL</code>, if the list
162 * is now empty 168 * is now empty
163 */ 169 */
164 UcxList *ucx_list_remove(UcxList *list, UcxList *element); 170 UcxList *ucx_list_remove(UcxList *list, UcxList *element);
171 UcxList *ucx_list_remove_a(UcxAllocator *allocator, UcxList *list,
172 UcxList *element);
165 173
166 #ifdef __cplusplus 174 #ifdef __cplusplus
167 } 175 }
168 #endif 176 #endif
169 177

mercurial