summaryrefslogtreecommitdiff
path: root/read-tree.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-04-04 13:43:00 -0700
committerJunio C Hamano <junkio@cox.net>2006-04-04 13:43:00 -0700
commit810e1523753553968aac827f57e0e24fc9af6546 (patch)
tree47ec02a8c4a16c1f04e79e10a9b47cbcdfe4f564 /read-tree.c
parent4c61b7d15a6215fa4dffa33c37c3ef9df80d3f67 (diff)
parent90321c106ca6e36c0e884ca677c9a52dea47bdde (diff)
downloadgit-810e1523753553968aac827f57e0e24fc9af6546.tar.gz
Merge branch 'pe/cleanup'
* pe/cleanup: Replace xmalloc+memset(0) with xcalloc. Use blob_, commit_, tag_, and tree_type throughout.
Diffstat (limited to 'read-tree.c')
-rw-r--r--read-tree.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/read-tree.c b/read-tree.c
index 4422dbf424..26f4f7e323 100644
--- a/read-tree.c
+++ b/read-tree.c
@@ -133,11 +133,9 @@ static int unpack_trees_rec(struct tree_entry_list **posns, int len,
pathlen = strlen(first);
ce_size = cache_entry_size(baselen + pathlen);
- src = xmalloc(sizeof(struct cache_entry *) * src_size);
- memset(src, 0, sizeof(struct cache_entry *) * src_size);
+ src = xcalloc(src_size, sizeof(struct cache_entry *));
- subposns = xmalloc(sizeof(struct tree_list_entry *) * len);
- memset(subposns, 0, sizeof(struct tree_list_entry *) * len);
+ subposns = xcalloc(len, sizeof(struct tree_list_entry *));
if (cache_name && !strcmp(cache_name, first)) {
any_files = 1;
@@ -177,8 +175,7 @@ static int unpack_trees_rec(struct tree_entry_list **posns, int len,
else
ce_stage = 2;
- ce = xmalloc(ce_size);
- memset(ce, 0, ce_size);
+ ce = xcalloc(1, ce_size);
ce->ce_mode = create_ce_mode(posns[i]->mode);
ce->ce_flags = create_ce_flags(baselen + pathlen,
ce_stage);