MCPcopy Index your code
hub / github.com/git/git / hashmap_init

Function hashmap_init

hashmap.c:153–175  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

151}
152
153void hashmap_init(struct hashmap *map, hashmap_cmp_fn equals_function,
154 const void *cmpfn_data, size_t initial_size)
155{
156 unsigned int size = HASHMAP_INITIAL_SIZE;
157
158 memset(map, 0, sizeof(*map));
159
160 map->cmpfn = equals_function ? equals_function : always_equal;
161 map->cmpfn_data = cmpfn_data;
162
163 /* calculate initial table size and allocate the table */
164 initial_size = (unsigned int) ((uint64_t) initial_size * 100
165 / HASHMAP_LOAD_FACTOR);
166 while (initial_size > size)
167 size <<= HASHMAP_RESIZE_BITS;
168 alloc_table(map, size);
169
170 /*
171 * Keep track of the number of items in the map and
172 * allow the map to automatically grow as necessary.
173 */
174 map->do_count_items = 1;
175}
176
177static void free_individual_entries(struct hashmap *map, ssize_t entry_offset)
178{

Callers 15

git_configset_initFunction · 0.85
lazy_init_worktree_mapFunction · 0.85
find_exact_renamesFunction · 0.85
get_fingerprintFunction · 0.85
add_delta_base_cacheFunction · 0.85
make_script_with_mergesFunction · 0.85
remote_state_newFunction · 0.85
add_patterns_from_bufferFunction · 0.85
submodule_cache_initFunction · 0.85
meminternFunction · 0.85
strmap_init_with_optionsFunction · 0.85

Calls 1

alloc_tableFunction · 0.85

Tested by 1

perf_hashmapFunction · 0.68