From 90321c106ca6e36c0e884ca677c9a52dea47bdde Mon Sep 17 00:00:00 2001 From: Peter Eriksen Date: Mon, 3 Apr 2006 19:30:46 +0100 Subject: Replace xmalloc+memset(0) with xcalloc. Signed-off-by: Peter Eriksen Signed-off-by: Junio C Hamano --- apply.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'apply.c') diff --git a/apply.c b/apply.c index cc3f12e555..33b4271288 100644 --- a/apply.c +++ b/apply.c @@ -925,8 +925,7 @@ static int parse_single_patch(char *line, unsigned long size, struct patch *patc struct fragment *fragment; int len; - fragment = xmalloc(sizeof(*fragment)); - memset(fragment, 0, sizeof(*fragment)); + fragment = xcalloc(1, sizeof(*fragment)); len = parse_fragment(line, size, patch, fragment); if (len <= 0) die("corrupt patch at line %d", linenr); @@ -1652,8 +1651,7 @@ static void add_index_file(const char *path, unsigned mode, void *buf, unsigned if (!write_index) return; - ce = xmalloc(ce_size); - memset(ce, 0, ce_size); + ce = xcalloc(1, ce_size); memcpy(ce->name, path, namelen); ce->ce_mode = create_ce_mode(mode); ce->ce_flags = htons(namelen); @@ -1809,8 +1807,7 @@ static int apply_patch(int fd, const char *filename) struct patch *patch; int nr; - patch = xmalloc(sizeof(*patch)); - memset(patch, 0, sizeof(*patch)); + patch = xcalloc(1, sizeof(*patch)); nr = parse_chunk(buffer + offset, size, patch); if (nr < 0) break; -- cgit v1.2.3