Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrandon Casey <casey@nrlssc.navy.mil>2008-10-07 03:39:10 +0400
committerShawn O. Pearce <spearce@spearce.org>2008-10-08 18:30:59 +0400
commit19d4b416f429ac2d3f4c225aaf1af8761bcb03dd (patch)
tree6675797b5e141a32cf8c4d551be3dddc5e5fc020 /builtin-pack-objects.c
parent276328ffb87cefdc515bee5f09916aea6e0244ed (diff)
Replace xmalloc/memset(0) pairs with xcalloc
Many call sites immediately initialize allocated memory with zero after calling xmalloc. A single call to xcalloc can replace this two-call sequence. Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'builtin-pack-objects.c')
-rw-r--r--builtin-pack-objects.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index 1158e42cba..59c30d1caa 100644
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
@@ -1369,12 +1369,10 @@ static void find_deltas(struct object_entry **list, unsigned *list_size,
int window, int depth, unsigned *processed)
{
uint32_t i, idx = 0, count = 0;
- unsigned int array_size = window * sizeof(struct unpacked);
struct unpacked *array;
unsigned long mem_usage = 0;
- array = xmalloc(array_size);
- memset(array, 0, array_size);
+ array = xcalloc(window, sizeof(struct unpacked));
for (;;) {
struct object_entry *entry = *list++;