# HG changeset patch # User Mike Becker # Date 1681838344 -7200 # Node ID c27fa8b672866e00c5d50a306f1d574d742ec7ab # Parent 612ed521b1c576ea9ddf096db39d62c8135faaad serious code formatting problems ;-) diff -r 612ed521b1c5 -r c27fa8b67286 src/hash_map.c --- a/src/hash_map.c Tue Apr 18 19:15:50 2023 +0200 +++ b/src/hash_map.c Tue Apr 18 19:19:04 2023 +0200 @@ -224,7 +224,7 @@ CxMap const *map, CxHashKey key ) { - // we can safely cast, because we know when remove=false, the map stays untouched + // we can safely cast, because we know the map stays untouched return cx_hash_map_get_remove((CxMap *) map, key, false, false); } @@ -428,12 +428,14 @@ buckets = 16; } - struct cx_hash_map_s *map = cxCalloc(allocator, 1, sizeof(struct cx_hash_map_s)); + struct cx_hash_map_s *map = cxCalloc(allocator, 1, + sizeof(struct cx_hash_map_s)); if (map == NULL) return NULL; // initialize hash map members map->bucket_count = buckets; - map->buckets = cxCalloc(allocator, buckets, sizeof(struct cx_hash_map_element_s *)); + map->buckets = cxCalloc(allocator, buckets, + sizeof(struct cx_hash_map_element_s *)); if (map->buckets == NULL) { cxFree(allocator, map); return NULL; @@ -459,8 +461,10 @@ if (map->size > ((hash_map->bucket_count * 3) >> 2)) { size_t new_bucket_count = (map->size * 5) >> 1; - struct cx_hash_map_element_s **new_buckets = cxCalloc(map->allocator, - new_bucket_count, sizeof(struct cx_hash_map_element_s *)); + struct cx_hash_map_element_s **new_buckets = cxCalloc( + map->allocator, + new_bucket_count, sizeof(struct cx_hash_map_element_s *) + ); if (new_buckets == NULL) { return 1; @@ -476,7 +480,8 @@ // find position where to insert struct cx_hash_map_element_s *bucket_next = new_buckets[new_slot]; struct cx_hash_map_element_s *bucket_prev = NULL; - while (bucket_next != NULL && bucket_next->key.hash < elm->key.hash) { + while (bucket_next != NULL && + bucket_next->key.hash < elm->key.hash) { bucket_prev = bucket_next; bucket_next = bucket_next->next; }