src/hash_map.c

changeset 554
fd3d843b839d
parent 551
2946e13c89a4
child 557
2aae1246b578
equal deleted inserted replaced
553:8f7d3e7b5b93 554:fd3d843b839d
333 iter.index = 0; 333 iter.index = 0;
334 iter.remove = false; 334 iter.remove = false;
335 335
336 if (map->size > 0) { 336 if (map->size > 0) {
337 struct cx_hash_map_s *hash_map = (struct cx_hash_map_s *) map; 337 struct cx_hash_map_s *hash_map = (struct cx_hash_map_s *) map;
338 struct cx_hash_map_element_s *elem = NULL; 338 struct cx_hash_map_element_s *elm = NULL;
339 for (; elem == NULL; iter.slot++) { 339 for (; elm == NULL; iter.slot++) {
340 elem = hash_map->buckets[iter.slot]; 340 elm = hash_map->buckets[iter.slot];
341 } 341 }
342 iter.elem_handle = elem; 342 iter.elem_handle = elm;
343 iter.kv_data.key = NULL; 343 iter.kv_data.key = &elm->key;
344 iter.kv_data.value = NULL; 344 // TODO: pointer to data if this map is storing copies
345 iter.kv_data.value = elm->data;
345 } else { 346 } else {
346 iter.elem_handle = NULL; 347 iter.elem_handle = NULL;
347 iter.kv_data.key = NULL; 348 iter.kv_data.key = NULL;
348 iter.kv_data.value = NULL; 349 iter.kv_data.value = NULL;
349 } 350 }

mercurial