summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-06-25 11:48:42 -0700
committerJunio C Hamano <gitster@pobox.com>2014-06-25 11:48:43 -0700
commit5327207e0fbc442b34e6371c1f28b5ed21aef8a0 (patch)
tree5d551bfd41926d1a2c718567c234c7f39b0e48c3
parent5fa38cc3a47c197a352dc52a1b373162c84b8697 (diff)
parentfb79947487b628ec82bc0ad46a08629539a59091 (diff)
downloadgit-5327207e0fbc442b34e6371c1f28b5ed21aef8a0.tar.gz
Merge branch 'rs/pack-objects-no-unnecessary-realloc' into maint
"git pack-objects" unnecessarily copied the previous contents when extending the hashtable, even though it will populate the table from scratch anyway. * rs/pack-objects-no-unnecessary-realloc: pack-objects: use free()+xcalloc() instead of xrealloc()+memset()
-rw-r--r--pack-objects.c4
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;