src/list.c

changeset 764
ccbdbd088455
parent 708
1caed6c9ba68
child 776
874cc78cdffd
equal deleted inserted replaced
763:741a2040fa33 764:ccbdbd088455
113 ) { 113 ) {
114 void **ptr = list->climpl->at(list, index); 114 void **ptr = list->climpl->at(list, index);
115 return ptr == NULL ? NULL : *ptr; 115 return ptr == NULL ? NULL : *ptr;
116 } 116 }
117 117
118 static ssize_t cx_pl_find( 118 static ssize_t cx_pl_find_remove(
119 struct cx_list_s const *list, 119 struct cx_list_s *list,
120 void const *elem 120 void const *elem,
121 bool remove
121 ) { 122 ) {
122 cx_pl_hack_cmpfunc(list); 123 cx_pl_hack_cmpfunc(list);
123 ssize_t ret = list->climpl->find(list, &elem); 124 ssize_t ret = list->climpl->find_remove(list, &elem, remove);
124 cx_pl_unhack_cmpfunc(list); 125 cx_pl_unhack_cmpfunc(list);
125 return ret; 126 return ret;
126 } 127 }
127 128
128 static void cx_pl_sort(struct cx_list_s *list) { 129 static void cx_pl_sort(struct cx_list_s *list) {
169 cx_pl_insert_iter, 170 cx_pl_insert_iter,
170 cx_pl_remove, 171 cx_pl_remove,
171 cx_pl_clear, 172 cx_pl_clear,
172 cx_pl_swap, 173 cx_pl_swap,
173 cx_pl_at, 174 cx_pl_at,
174 cx_pl_find, 175 cx_pl_find_remove,
175 cx_pl_sort, 176 cx_pl_sort,
176 cx_pl_compare, 177 cx_pl_compare,
177 cx_pl_reverse, 178 cx_pl_reverse,
178 cx_pl_iterator, 179 cx_pl_iterator,
179 }; 180 };
206 __attribute__((__unused__)) size_t index 207 __attribute__((__unused__)) size_t index
207 ) { 208 ) {
208 return NULL; 209 return NULL;
209 } 210 }
210 211
211 static ssize_t cx_emptyl_find( 212 static ssize_t cx_emptyl_find_remove(
212 __attribute__((__unused__)) struct cx_list_s const *list, 213 __attribute__((__unused__)) struct cx_list_s *list,
213 __attribute__((__unused__)) void const *elem 214 __attribute__((__unused__)) void const *elem,
215 __attribute__((__unused__)) bool remove
214 ) { 216 ) {
215 return -1; 217 return -1;
216 } 218 }
217 219
218 static int cx_emptyl_compare( 220 static int cx_emptyl_compare(
246 NULL, 248 NULL,
247 NULL, 249 NULL,
248 cx_emptyl_noop, 250 cx_emptyl_noop,
249 NULL, 251 NULL,
250 cx_emptyl_at, 252 cx_emptyl_at,
251 cx_emptyl_find, 253 cx_emptyl_find_remove,
252 cx_emptyl_noop, 254 cx_emptyl_noop,
253 cx_emptyl_compare, 255 cx_emptyl_compare,
254 cx_emptyl_noop, 256 cx_emptyl_noop,
255 cx_emptyl_iterator, 257 cx_emptyl_iterator,
256 }; 258 };

mercurial