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) { |
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( |
291 ((list->climpl != NULL ? list->climpl->compare : list->cl->compare) != |
293 ((list->climpl != NULL ? list->climpl->compare : list->cl->compare) != |
292 (other->climpl != NULL ? other->climpl->compare : other->cl->compare)) |
294 (other->climpl != NULL ? other->climpl->compare : other->cl->compare)) |
293 ) { |
295 ) { |
294 // lists are definitely different - cannot use internal compare function |
296 // lists are definitely different - cannot use internal compare function |
295 if (list->size == other->size) { |
297 if (list->size == other->size) { |
296 CxIterator left = cxListIterator(list); |
298 CxIterator left = list->cl->iterator(list, 0, false); |
297 CxIterator right = cxListIterator(other); |
299 CxIterator right = other->cl->iterator(other, 0, false); |
298 for (size_t i = 0; i < list->size; i++) { |
300 for (size_t i = 0; i < list->size; i++) { |
299 void *leftValue = cxIteratorCurrent(left); |
301 void *leftValue = cxIteratorCurrent(left); |
300 void *rightValue = cxIteratorCurrent(right); |
302 void *rightValue = cxIteratorCurrent(right); |
301 int d = list->cmpfunc(leftValue, rightValue); |
303 int d = list->cmpfunc(leftValue, rightValue); |
302 if (d != 0) { |
304 if (d != 0) { |