From 19d4b416f429ac2d3f4c225aaf1af8761bcb03dd Mon Sep 17 00:00:00 2001 From: Brandon Casey Date: Mon, 6 Oct 2008 18:39:10 -0500 Subject: 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 Signed-off-by: Shawn O. Pearce --- merge-tree.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'merge-tree.c') diff --git a/merge-tree.c b/merge-tree.c index 02fc10f7e6..2d1413efbb 100644 --- a/merge-tree.c +++ b/merge-tree.c @@ -158,9 +158,8 @@ static int same_entry(struct name_entry *a, struct name_entry *b) static struct merge_list *create_entry(unsigned stage, unsigned mode, const unsigned char *sha1, const char *path) { - struct merge_list *res = xmalloc(sizeof(*res)); + struct merge_list *res = xcalloc(1, sizeof(*res)); - memset(res, 0, sizeof(*res)); res->stage = stage; res->path = path; res->mode = mode; -- cgit v1.2.1