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:
Junio C Hamano 2014-06-16 12:18:42 -07:00
commit 57a2eee925

View file

@ -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;