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:
Chris Dunlap
2014-09-22 13:22:48 -07:00
committed by Brian Behlendorf
parent bee6665b88
commit 8cb8cf91df
3 changed files with 4 additions and 8 deletions
+1 -1
View File
@@ -61,7 +61,7 @@ _zed_exec_create_env(zed_strings_t *zsp)
for (q = zed_strings_first(zsp); q; q = zed_strings_next(zsp))
buflen += strlen(q) + 1;
buf = malloc(buflen);
buf = calloc(1, buflen);
if (!buf)
return (NULL);