svn commit: r277554 - stable/10/cddl/compat/opensolaris/misc
Xin LI
delphij at FreeBSD.org
Fri Jan 23 00:54:57 UTC 2015
Author: delphij
Date: Fri Jan 23 00:54:56 2015
New Revision: 277554
URL: https://svnweb.freebsd.org/changeset/base/277554
Log:
MFC r275595:
Use calloc() instead of malloc() + bzero(). This also gets rid of a warning
because bzero is defined by strings.h which is not included in thread_pool.c.
Modified:
stable/10/cddl/compat/opensolaris/misc/thread_pool.c
Directory Properties:
stable/10/ (props changed)
Modified: stable/10/cddl/compat/opensolaris/misc/thread_pool.c
==============================================================================
--- stable/10/cddl/compat/opensolaris/misc/thread_pool.c Fri Jan 23 00:44:14 2015 (r277553)
+++ stable/10/cddl/compat/opensolaris/misc/thread_pool.c Fri Jan 23 00:54:56 2015 (r277554)
@@ -233,12 +233,11 @@ tpool_create(uint_t min_threads, uint_t
return (NULL);
}
- tpool = malloc(sizeof (*tpool));
+ tpool = calloc(1, sizeof (*tpool));
if (tpool == NULL) {
errno = ENOMEM;
return (NULL);
}
- bzero(tpool, sizeof(*tpool));
(void) pthread_mutex_init(&tpool->tp_mutex, NULL);
(void) pthread_cond_init(&tpool->tp_busycv, NULL);
(void) pthread_cond_init(&tpool->tp_workcv, NULL);
@@ -267,9 +266,8 @@ tpool_dispatch(tpool_t *tpool, void (*fu
{
tpool_job_t *job;
- if ((job = malloc(sizeof (*job))) == NULL)
+ if ((job = calloc(1, sizeof (*job))) == NULL)
return (-1);
- bzero(job, sizeof(*job));
job->tpj_next = NULL;
job->tpj_func = func;
job->tpj_arg = arg;
More information about the svn-src-stable
mailing list