aboutsummaryrefslogtreecommitdiff
path: root/update-index.c
diff options
context:
space:
mode:
authorPeter Eriksen <s022018@student.dtu.dk>2006-04-03 19:30:46 +0100
committerJunio C Hamano <junkio@cox.net>2006-04-04 00:11:19 -0700
commit90321c106ca6e36c0e884ca677c9a52dea47bdde (patch)
treec574dde6987912d2197af80a5f7f8827cde263cc /update-index.c
parent8e4402592574d630cdb5ab4f55a1b7131802ff72 (diff)
downloadgit-90321c106ca6e36c0e884ca677c9a52dea47bdde.tar.gz
git-90321c106ca6e36c0e884ca677c9a52dea47bdde.tar.xz
Replace xmalloc+memset(0) with xcalloc.
Signed-off-by: Peter Eriksen <s022018@student.dtu.dk> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'update-index.c')
-rw-r--r--update-index.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/update-index.c b/update-index.c
index 797245ab2..1efac27c6 100644
--- a/update-index.c
+++ b/update-index.c
@@ -114,8 +114,7 @@ static int add_file_to_cache(const char *path)
namelen = strlen(path);
size = cache_entry_size(namelen);
- ce = xmalloc(size);
- memset(ce, 0, size);
+ ce = xcalloc(1, size);
memcpy(ce->name, path, namelen);
ce->ce_flags = htons(namelen);
fill_stat_cache_info(ce, &st);
@@ -312,8 +311,7 @@ static int add_cacheinfo(unsigned int mode, const unsigned char *sha1,
len = strlen(path);
size = cache_entry_size(len);
- ce = xmalloc(size);
- memset(ce, 0, size);
+ ce = xcalloc(1, size);
memcpy(ce->sha1, sha1, 20);
memcpy(ce->name, path, len);