317 |
319 |
318 static size_t cx_arl_find( |
320 static size_t cx_arl_find( |
319 struct cx_list_s const *list, |
321 struct cx_list_s const *list, |
320 void const *elem |
322 void const *elem |
321 ) { |
323 ) { |
|
324 assert(list->cmpfunc != NULL); |
322 char *cur = ((cx_array_list const *) list)->data; |
325 char *cur = ((cx_array_list const *) list)->data; |
323 |
326 |
324 for (size_t i = 0; i < list->size; i++) { |
327 for (size_t i = 0; i < list->size; i++) { |
325 if (0 == list->cmpfunc(elem, cur)) { |
328 if (0 == list->cmpfunc(elem, cur)) { |
326 return i; |
329 return i; |
341 |
345 |
342 static int cx_arl_compare( |
346 static int cx_arl_compare( |
343 struct cx_list_s const *list, |
347 struct cx_list_s const *list, |
344 struct cx_list_s const *other |
348 struct cx_list_s const *other |
345 ) { |
349 ) { |
|
350 assert(list->cmpfunc != NULL); |
346 if (list->size == other->size) { |
351 if (list->size == other->size) { |
347 char const *left = ((cx_array_list const *) list)->data; |
352 char const *left = ((cx_array_list const *) list)->data; |
348 char const *right = ((cx_array_list const *) other)->data; |
353 char const *right = ((cx_array_list const *) other)->data; |
349 for (size_t i = 0; i < list->size; i++) { |
354 for (size_t i = 0; i < list->size; i++) { |
350 int d = list->cmpfunc(left, right); |
355 int d = list->cmpfunc(left, right); |