Mon, 20 Mar 2023 18:05:12 +0100
fix hashmap iterator skipping the second element in some cases
src/hash_map.c | file | annotate | diff | comparison | revisions |
--- a/src/hash_map.c Tue Mar 14 20:25:24 2023 +0100 +++ b/src/hash_map.c Mon Mar 20 18:05:12 2023 +0100 @@ -339,8 +339,8 @@ if (map->size > 0) { struct cx_hash_map_s *hash_map = (struct cx_hash_map_s *) map; struct cx_hash_map_element_s *elm = hash_map->buckets[0]; - for (; elm == NULL; iter.slot++) { - elm = hash_map->buckets[iter.slot]; + while (elm == NULL) { + elm = hash_map->buckets[++iter.slot]; } iter.elem_handle = elm; iter.kv_data.key = &elm->key;