Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
Merge branch 'rs/pack-objects-no-unnecessary-realloc'
author
Junio C Hamano
<gitster@pobox.com>
Mon, 16 Jun 2014 19:18:42 +0000
(12:18 -0700)
committer
Junio C Hamano
<gitster@pobox.com>
Mon, 16 Jun 2014 19:18:42 +0000
(12:18 -0700)
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()
pack-objects.c
patch
|
blob
|
history
raw
(from parent 1:
3009afd
)
diff --git
a/pack-objects.c
b/pack-objects.c
index d01d851ce957c779ff98d243fea4476fa7a1008c..4f36c3204544c40ada8e6ce584deb6063b055518 100644
(file)
--- 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;