Tue, 18 Apr 2023 19:19:04 +0200
serious code formatting problems ;-)
src/hash_map.c | file | annotate | diff | comparison | revisions |
1.1 --- a/src/hash_map.c Tue Apr 18 19:15:50 2023 +0200 1.2 +++ b/src/hash_map.c Tue Apr 18 19:19:04 2023 +0200 1.3 @@ -224,7 +224,7 @@ 1.4 CxMap const *map, 1.5 CxHashKey key 1.6 ) { 1.7 - // we can safely cast, because we know when remove=false, the map stays untouched 1.8 + // we can safely cast, because we know the map stays untouched 1.9 return cx_hash_map_get_remove((CxMap *) map, key, false, false); 1.10 } 1.11 1.12 @@ -428,12 +428,14 @@ 1.13 buckets = 16; 1.14 } 1.15 1.16 - struct cx_hash_map_s *map = cxCalloc(allocator, 1, sizeof(struct cx_hash_map_s)); 1.17 + struct cx_hash_map_s *map = cxCalloc(allocator, 1, 1.18 + sizeof(struct cx_hash_map_s)); 1.19 if (map == NULL) return NULL; 1.20 1.21 // initialize hash map members 1.22 map->bucket_count = buckets; 1.23 - map->buckets = cxCalloc(allocator, buckets, sizeof(struct cx_hash_map_element_s *)); 1.24 + map->buckets = cxCalloc(allocator, buckets, 1.25 + sizeof(struct cx_hash_map_element_s *)); 1.26 if (map->buckets == NULL) { 1.27 cxFree(allocator, map); 1.28 return NULL; 1.29 @@ -459,8 +461,10 @@ 1.30 if (map->size > ((hash_map->bucket_count * 3) >> 2)) { 1.31 1.32 size_t new_bucket_count = (map->size * 5) >> 1; 1.33 - struct cx_hash_map_element_s **new_buckets = cxCalloc(map->allocator, 1.34 - new_bucket_count, sizeof(struct cx_hash_map_element_s *)); 1.35 + struct cx_hash_map_element_s **new_buckets = cxCalloc( 1.36 + map->allocator, 1.37 + new_bucket_count, sizeof(struct cx_hash_map_element_s *) 1.38 + ); 1.39 1.40 if (new_buckets == NULL) { 1.41 return 1; 1.42 @@ -476,7 +480,8 @@ 1.43 // find position where to insert 1.44 struct cx_hash_map_element_s *bucket_next = new_buckets[new_slot]; 1.45 struct cx_hash_map_element_s *bucket_prev = NULL; 1.46 - while (bucket_next != NULL && bucket_next->key.hash < elm->key.hash) { 1.47 + while (bucket_next != NULL && 1.48 + bucket_next->key.hash < elm->key.hash) { 1.49 bucket_prev = bucket_next; 1.50 bucket_next = bucket_next->next; 1.51 }