Merge branch 'rs/pack-objects-no-unnecessary-realloc'
Avoid unnecessary copy of previous contents when extending the hashtable used in pack-objects. * rs/pack-objects-no-unnecessary-realloc: pack-objects: use free()+xcalloc() instead of xrealloc()+memset()
This commit is contained in:
commit
57a2eee925
@ -47,8 +47,8 @@ static void rehash_objects(struct packing_data *pdata)
|
||||
if (pdata->index_size < 1024)
|
||||
pdata->index_size = 1024;
|
||||
|
||||
pdata->index = xrealloc(pdata->index, sizeof(uint32_t) * pdata->index_size);
|
||||
memset(pdata->index, 0, sizeof(int) * pdata->index_size);
|
||||
free(pdata->index);
|
||||
pdata->index = xcalloc(pdata->index_size, sizeof(*pdata->index));
|
||||
|
||||
entry = pdata->objects;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user