ucx/map.c

changeset 818
bc782cca0759
parent 816
839fefbdedc7
--- a/ucx/map.c	Thu May 23 23:19:06 2024 +0200
+++ b/ucx/map.c	Thu May 23 23:23:36 2024 +0200
@@ -51,7 +51,7 @@
         __attribute__((__unused__)) enum cx_map_iterator_type type
 ) {
     CxIterator iter = {0};
-    iter.src_handle = map;
+    iter.src_handle.c = map;
     iter.base.valid = cx_empty_map_iter_valid;
     return iter;
 }
@@ -66,14 +66,16 @@
 };
 
 CxMap cx_empty_map = {
-        NULL,
-        NULL,
-        0,
-        0,
-        NULL,
-        NULL,
-        NULL,
-        false,
+        {
+                NULL,
+                NULL,
+                0,
+                0,
+                NULL,
+                NULL,
+                NULL,
+                false
+        },
         &cx_empty_map_class
 };
 
@@ -81,32 +83,20 @@
 
 // </editor-fold>
 
-CxMutIterator cxMapMutIteratorValues(CxMap *map) {
+CxIterator cxMapMutIteratorValues(CxMap *map) {
     CxIterator it = map->cl->iterator(map, CX_MAP_ITERATOR_VALUES);
     it.base.mutating = true;
-
-    // we know the iterators share the same memory layout
-    CxMutIterator iter;
-    memcpy(&iter, &it, sizeof(CxMutIterator));
-    return iter;
+    return it;
 }
 
-CxMutIterator cxMapMutIteratorKeys(CxMap *map) {
+CxIterator cxMapMutIteratorKeys(CxMap *map) {
     CxIterator it = map->cl->iterator(map, CX_MAP_ITERATOR_KEYS);
     it.base.mutating = true;
-
-    // we know the iterators share the same memory layout
-    CxMutIterator iter;
-    memcpy(&iter, &it, sizeof(CxMutIterator));
-    return iter;
+    return it;
 }
 
-CxMutIterator cxMapMutIterator(CxMap *map) {
+CxIterator cxMapMutIterator(CxMap *map) {
     CxIterator it = map->cl->iterator(map, CX_MAP_ITERATOR_PAIRS);
     it.base.mutating = true;
-
-    // we know the iterators share the same memory layout
-    CxMutIterator iter;
-    memcpy(&iter, &it, sizeof(CxMutIterator));
-    return iter;
+    return it;
 }

mercurial