mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-25 11:47:43 +03:00
Replace zed's use of malloc with calloc
When zed allocates memory via malloc(), it typically follows that with a memset(). However, calloc() implementations can often perform optimizations when zeroing memory: https://stackoverflow.com/questions/2688466/why-mallocmemset-is-slower-than-calloc This commit replaces zed's use of malloc() with calloc(). Signed-off-by: Chris Dunlap <cdunlap@llnl.gov> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #2736
This commit is contained in:
committed by
Brian Behlendorf
parent
bee6665b88
commit
8cb8cf91df
+1
-3
@@ -51,12 +51,10 @@ zed_conf_create(void)
|
||||
{
|
||||
struct zed_conf *zcp;
|
||||
|
||||
zcp = malloc(sizeof (*zcp));
|
||||
zcp = calloc(1, sizeof (*zcp));
|
||||
if (!zcp)
|
||||
goto nomem;
|
||||
|
||||
memset(zcp, 0, sizeof (*zcp));
|
||||
|
||||
zcp->syslog_facility = LOG_DAEMON;
|
||||
zcp->min_events = ZED_MIN_EVENTS;
|
||||
zcp->max_events = ZED_MAX_EVENTS;
|
||||
|
||||
Reference in New Issue
Block a user