aboutsummaryrefslogtreecommitdiff
path: root/apply.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 /apply.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 'apply.c')
-rw-r--r--apply.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/apply.c b/apply.c
index cc3f12e55..33b427128 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;