diff -r 16e2a3391e88 -r d4baf4dd55c3 src/array_list.c --- a/src/array_list.c Thu May 23 18:21:36 2024 +0200 +++ b/src/array_list.c Thu May 23 19:29:14 2024 +0200 @@ -273,11 +273,11 @@ } static int cx_arl_insert_iter( - struct cx_mut_iterator_s *iter, + struct cx_iterator_s *iter, void const *elem, int prepend ) { - struct cx_list_s *list = iter->src_handle; + struct cx_list_s *list = iter->src_handle.m; if (iter->index < list->size) { int result = cx_arl_insert_element( list, @@ -453,7 +453,7 @@ static bool cx_arl_iter_valid(void const *it) { struct cx_iterator_s const *iter = it; - struct cx_list_s const *list = iter->src_handle; + struct cx_list_s const *list = iter->src_handle.c; return iter->index < list->size; } @@ -463,27 +463,24 @@ } static void cx_arl_iter_next(void *it) { - struct cx_iterator_base_s *itbase = it; - if (itbase->remove) { - struct cx_mut_iterator_s *iter = it; - itbase->remove = false; - cx_arl_remove(iter->src_handle, iter->index); + struct cx_iterator_s *iter = it; + if (iter->remove) { + iter->remove = false; + cx_arl_remove(iter->src_handle.m, iter->index); } else { - struct cx_iterator_s *iter = it; iter->index++; iter->elem_handle = ((char *) iter->elem_handle) - + ((struct cx_list_s const *) iter->src_handle)->item_size; + + ((struct cx_list_s const *) iter->src_handle.c)->item_size; } } static void cx_arl_iter_prev(void *it) { - struct cx_iterator_base_s *itbase = it; - struct cx_mut_iterator_s *iter = it; - cx_array_list *const list = iter->src_handle; - if (itbase->remove) { - itbase->remove = false; - cx_arl_remove(iter->src_handle, iter->index); + struct cx_iterator_s *iter = it; + cx_array_list const* list = iter->src_handle.c; + if (iter->remove) { + iter->remove = false; + cx_arl_remove(iter->src_handle.m, iter->index); } iter->index--; if (iter->index < list->base.size) { @@ -501,15 +498,15 @@ struct cx_iterator_s iter; iter.index = index; - iter.src_handle = list; + iter.src_handle.c = list; iter.elem_handle = cx_arl_at(list, index); iter.elem_size = list->item_size; iter.elem_count = list->size; - iter.base.valid = cx_arl_iter_valid; - iter.base.current = cx_arl_iter_current; - iter.base.next = backwards ? cx_arl_iter_prev : cx_arl_iter_next; - iter.base.remove = false; - iter.base.mutating = false; + iter.valid = cx_arl_iter_valid; + iter.current = cx_arl_iter_current; + iter.next = backwards ? cx_arl_iter_prev : cx_arl_iter_next; + iter.remove = false; + iter.mutating = false; return iter; }