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

Function rehash

hashmap.c:115–133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

113}
114
115static void rehash(struct hashmap *map, unsigned int newsize)
116{
117 /* map->table MUST NOT be NULL when this function is called */
118 unsigned int i, oldsize = map->tablesize;
119 struct hashmap_entry **oldtable = map->table;
120
121 alloc_table(map, newsize);
122 for (i = 0; i < oldsize; i++) {
123 struct hashmap_entry *e = oldtable[i];
124 while (e) {
125 struct hashmap_entry *next = e->next;
126 unsigned int b = bucket(map, e);
127 e->next = map->table[b];
128 map->table[b] = e;
129 e = next;
130 }
131 }
132 free(oldtable);
133}
134
135static inline struct hashmap_entry **find_entry_ptr(const struct hashmap *map,
136 const struct hashmap_entry *key, const void *keydata)

Callers 2

hashmap_addFunction · 0.85
hashmap_removeFunction · 0.85

Calls 2

alloc_tableFunction · 0.85
bucketFunction · 0.85

Tested by

no test coverage detected