1.1 --- a/src/array_list.c Thu May 23 18:21:36 2024 +0200 1.2 +++ b/src/array_list.c Thu May 23 19:29:14 2024 +0200 1.3 @@ -273,11 +273,11 @@ 1.4 } 1.5 1.6 static int cx_arl_insert_iter( 1.7 - struct cx_mut_iterator_s *iter, 1.8 + struct cx_iterator_s *iter, 1.9 void const *elem, 1.10 int prepend 1.11 ) { 1.12 - struct cx_list_s *list = iter->src_handle; 1.13 + struct cx_list_s *list = iter->src_handle.m; 1.14 if (iter->index < list->size) { 1.15 int result = cx_arl_insert_element( 1.16 list, 1.17 @@ -453,7 +453,7 @@ 1.18 1.19 static bool cx_arl_iter_valid(void const *it) { 1.20 struct cx_iterator_s const *iter = it; 1.21 - struct cx_list_s const *list = iter->src_handle; 1.22 + struct cx_list_s const *list = iter->src_handle.c; 1.23 return iter->index < list->size; 1.24 } 1.25 1.26 @@ -463,27 +463,24 @@ 1.27 } 1.28 1.29 static void cx_arl_iter_next(void *it) { 1.30 - struct cx_iterator_base_s *itbase = it; 1.31 - if (itbase->remove) { 1.32 - struct cx_mut_iterator_s *iter = it; 1.33 - itbase->remove = false; 1.34 - cx_arl_remove(iter->src_handle, iter->index); 1.35 + struct cx_iterator_s *iter = it; 1.36 + if (iter->remove) { 1.37 + iter->remove = false; 1.38 + cx_arl_remove(iter->src_handle.m, iter->index); 1.39 } else { 1.40 - struct cx_iterator_s *iter = it; 1.41 iter->index++; 1.42 iter->elem_handle = 1.43 ((char *) iter->elem_handle) 1.44 - + ((struct cx_list_s const *) iter->src_handle)->item_size; 1.45 + + ((struct cx_list_s const *) iter->src_handle.c)->item_size; 1.46 } 1.47 } 1.48 1.49 static void cx_arl_iter_prev(void *it) { 1.50 - struct cx_iterator_base_s *itbase = it; 1.51 - struct cx_mut_iterator_s *iter = it; 1.52 - cx_array_list *const list = iter->src_handle; 1.53 - if (itbase->remove) { 1.54 - itbase->remove = false; 1.55 - cx_arl_remove(iter->src_handle, iter->index); 1.56 + struct cx_iterator_s *iter = it; 1.57 + cx_array_list const* list = iter->src_handle.c; 1.58 + if (iter->remove) { 1.59 + iter->remove = false; 1.60 + cx_arl_remove(iter->src_handle.m, iter->index); 1.61 } 1.62 iter->index--; 1.63 if (iter->index < list->base.size) { 1.64 @@ -501,15 +498,15 @@ 1.65 struct cx_iterator_s iter; 1.66 1.67 iter.index = index; 1.68 - iter.src_handle = list; 1.69 + iter.src_handle.c = list; 1.70 iter.elem_handle = cx_arl_at(list, index); 1.71 iter.elem_size = list->item_size; 1.72 iter.elem_count = list->size; 1.73 - iter.base.valid = cx_arl_iter_valid; 1.74 - iter.base.current = cx_arl_iter_current; 1.75 - iter.base.next = backwards ? cx_arl_iter_prev : cx_arl_iter_next; 1.76 - iter.base.remove = false; 1.77 - iter.base.mutating = false; 1.78 + iter.valid = cx_arl_iter_valid; 1.79 + iter.current = cx_arl_iter_current; 1.80 + iter.next = backwards ? cx_arl_iter_prev : cx_arl_iter_next; 1.81 + iter.remove = false; 1.82 + iter.mutating = false; 1.83 1.84 return iter; 1.85 }