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

Function grow_object_hash

object.c:125–146  ·  view source on GitHub ↗

* Increase the size of the hash map stored in obj_hash to the next * power of 2 (but at least 32). Copy the existing values to the new * hash map. */

Source from the content-addressed store, hash-verified

123 * hash map.
124 */
125static void grow_object_hash(struct repository *r)
126{
127 int i;
128 /*
129 * Note that this size must always be power-of-2 to match hash_obj
130 * above.
131 */
132 int new_hash_size = r->parsed_objects->obj_hash_size < 32 ? 32 : 2 * r->parsed_objects->obj_hash_size;
133 struct object **new_hash;
134
135 CALLOC_ARRAY(new_hash, new_hash_size);
136 for (i = 0; i < r->parsed_objects->obj_hash_size; i++) {
137 struct object *obj = r->parsed_objects->obj_hash[i];
138
139 if (!obj)
140 continue;
141 insert_obj_hash(obj, new_hash, new_hash_size);
142 }
143 free(r->parsed_objects->obj_hash);
144 r->parsed_objects->obj_hash = new_hash;
145 r->parsed_objects->obj_hash_size = new_hash_size;
146}
147
148void *create_object(struct repository *r, const struct object_id *oid, void *o)
149{

Callers 1

create_objectFunction · 0.85

Calls 1

insert_obj_hashFunction · 0.85

Tested by

no test coverage detected