1.1 --- a/src/hash_map.c Thu May 23 18:21:36 2024 +0200 1.2 +++ b/src/hash_map.c Thu May 23 19:29:14 2024 +0200 1.3 @@ -252,7 +252,7 @@ 1.4 1.5 static void *cx_hash_map_iter_current_value(void const *it) { 1.6 struct cx_iterator_s const *iter = it; 1.7 - struct cx_hash_map_s const *map = iter->src_handle; 1.8 + struct cx_hash_map_s const *map = iter->src_handle.c; 1.9 struct cx_hash_map_element_s *elm = iter->elem_handle; 1.10 if (map->base.store_pointer) { 1.11 return *(void **) elm->data; 1.12 @@ -269,15 +269,13 @@ 1.13 static void cx_hash_map_iter_next(void *it) { 1.14 struct cx_iterator_s *iter = it; 1.15 struct cx_hash_map_element_s *elm = iter->elem_handle; 1.16 + struct cx_hash_map_s *map = iter->src_handle.m; 1.17 1.18 // remove current element, if asked 1.19 - if (iter->base.remove) { 1.20 - // obtain mutable pointer to the map 1.21 - struct cx_mut_iterator_s *miter = it; 1.22 - struct cx_hash_map_s *map = miter->src_handle; 1.23 + if (iter->remove) { 1.24 1.25 // clear the flag 1.26 - iter->base.remove = false; 1.27 + iter->remove = false; 1.28 1.29 // determine the next element 1.30 struct cx_hash_map_element_s *next = elm->next; 1.31 @@ -306,7 +304,6 @@ 1.32 } 1.33 1.34 // search the next bucket, if required 1.35 - struct cx_hash_map_s const *map = iter->src_handle; 1.36 while (elm == NULL && ++iter->slot < map->bucket_count) { 1.37 elm = map->buckets[iter->slot]; 1.38 } 1.39 @@ -332,30 +329,30 @@ 1.40 ) { 1.41 CxIterator iter; 1.42 1.43 - iter.src_handle = map; 1.44 + iter.src_handle.c = map; 1.45 iter.elem_count = map->size; 1.46 1.47 switch (type) { 1.48 case CX_MAP_ITERATOR_PAIRS: 1.49 iter.elem_size = sizeof(CxMapEntry); 1.50 - iter.base.current = cx_hash_map_iter_current_entry; 1.51 + iter.current = cx_hash_map_iter_current_entry; 1.52 break; 1.53 case CX_MAP_ITERATOR_KEYS: 1.54 iter.elem_size = sizeof(CxHashKey); 1.55 - iter.base.current = cx_hash_map_iter_current_key; 1.56 + iter.current = cx_hash_map_iter_current_key; 1.57 break; 1.58 case CX_MAP_ITERATOR_VALUES: 1.59 iter.elem_size = map->item_size; 1.60 - iter.base.current = cx_hash_map_iter_current_value; 1.61 + iter.current = cx_hash_map_iter_current_value; 1.62 break; 1.63 default: 1.64 assert(false); 1.65 } 1.66 1.67 - iter.base.valid = cx_hash_map_iter_valid; 1.68 - iter.base.next = cx_hash_map_iter_next; 1.69 - iter.base.remove = false; 1.70 - iter.base.mutating = false; 1.71 + iter.valid = cx_hash_map_iter_valid; 1.72 + iter.next = cx_hash_map_iter_next; 1.73 + iter.remove = false; 1.74 + iter.mutating = false; 1.75 1.76 iter.slot = 0; 1.77 iter.index = 0;