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 <casey@nrlssc.navy.mil>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
This commit is contained in:
Brandon Casey
2008-10-06 18:39:10 -05:00
committed by Shawn O. Pearce
parent 276328ffb8
commit 19d4b416f4
5 changed files with 5 additions and 11 deletions

View File

@ -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;