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:

committed by
Shawn O. Pearce

parent
276328ffb8
commit
19d4b416f4
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user