diff options
author | Chris Dunlap <[email protected]> | 2014-09-22 13:22:48 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2014-09-25 13:43:57 -0700 |
commit | 8cb8cf91df8a4902025d814b62b9332ad1b291c7 (patch) | |
tree | 983b9c5daf33db035df66928735d336230fc9aca /cmd/zed/zed_conf.c | |
parent | bee6665b88fca3b5e70e8b3c8f6281975721c7be (diff) |
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 <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #2736
Diffstat (limited to 'cmd/zed/zed_conf.c')
-rw-r--r-- | cmd/zed/zed_conf.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/cmd/zed/zed_conf.c b/cmd/zed/zed_conf.c index 77f772ad5..fc7bd8a7e 100644 --- a/cmd/zed/zed_conf.c +++ b/cmd/zed/zed_conf.c @@ -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; |