diff options
author | Junio C Hamano <gitster@pobox.com> | 2014-06-16 12:18:42 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-06-16 12:18:42 -0700 |
commit | 57a2eee9250fadb72cb6bace963fd1ed683c83b8 (patch) | |
tree | 40bdce641bbd3106fec034acadf16555af534fb1 | |
parent | Merge branch 'lt/log-auto-decorate' (diff) | |
parent | pack-objects: use free()+xcalloc() instead of xrealloc()+memset() (diff) | |
download | tgif-57a2eee9250fadb72cb6bace963fd1ed683c83b8.tar.xz |
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()
-rw-r--r-- | pack-objects.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/pack-objects.c b/pack-objects.c index d01d851ce9..4f36c32045 100644 --- a/pack-objects.c +++ b/pack-objects.c @@ -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; |