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

@ -123,8 +123,7 @@ static struct strategy *get_strategy(const char *name)
exit(1);
}
ret = xmalloc(sizeof(struct strategy));
memset(ret, 0, sizeof(struct strategy));
ret = xcalloc(1, sizeof(struct strategy));
ret->name = xstrdup(name);
return ret;
}