src/list.c

changeset 664
af5bf4603a5d
parent 655
7340c4255f1f
child 666
b5dd654deb3b
equal deleted inserted replaced
663:d50b5dc1e058 664:af5bf4603a5d
93 size_t index 93 size_t index
94 ) { 94 ) {
95 return list->climpl->remove(list, index); 95 return list->climpl->remove(list, index);
96 } 96 }
97 97
98 static void cx_pl_clear(struct cx_list_s *list) {
99 list->climpl->clear(list);
100 }
101
98 static int cx_pl_swap( 102 static int cx_pl_swap(
99 struct cx_list_s *list, 103 struct cx_list_s *list,
100 size_t i, 104 size_t i,
101 size_t j 105 size_t j
102 ) { 106 ) {
162 cx_pl_destructor, 166 cx_pl_destructor,
163 cx_pl_insert_element, 167 cx_pl_insert_element,
164 cx_pl_insert_array, 168 cx_pl_insert_array,
165 cx_pl_insert_iter, 169 cx_pl_insert_iter,
166 cx_pl_remove, 170 cx_pl_remove,
171 cx_pl_clear,
167 cx_pl_swap, 172 cx_pl_swap,
168 cx_pl_at, 173 cx_pl_at,
169 cx_pl_find, 174 cx_pl_find,
170 cx_pl_sort, 175 cx_pl_sort,
171 cx_pl_compare, 176 cx_pl_compare,
189 bool cxListIsStoringPointers(CxList *list) { 194 bool cxListIsStoringPointers(CxList *list) {
190 return list->climpl != NULL; 195 return list->climpl != NULL;
191 } 196 }
192 197
193 // </editor-fold> 198 // </editor-fold>
199
200 void cx_list_invoke_destructor(
201 CxList const *list,
202 void *elem
203 ) {
204 switch (list->content_destructor_type) {
205 case CX_DESTRUCTOR_SIMPLE: {
206 list->simple_destructor(elem);
207 break;
208 }
209 case CX_DESTRUCTOR_ADVANCED: {
210 list->advanced_destructor.func(list->advanced_destructor.data, elem);
211 break;
212 }
213 case CX_DESTRUCTOR_NONE:
214 break; // nothing
215 }
216 }
194 217
195 void cxListDestroy(CxList *list) { 218 void cxListDestroy(CxList *list) {
196 switch (list->content_destructor_type) { 219 switch (list->content_destructor_type) {
197 case CX_DESTRUCTOR_SIMPLE: { 220 case CX_DESTRUCTOR_SIMPLE: {
198 CxIterator iter = cxListIterator(list); 221 CxIterator iter = cxListIterator(list);

mercurial