From owner-svn-src-all@FreeBSD.ORG Fri Jan 23 00:54:57 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8C43C6DE; Fri, 23 Jan 2015 00:54:57 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 773EBF90; Fri, 23 Jan 2015 00:54:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t0N0svri024836; Fri, 23 Jan 2015 00:54:57 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t0N0svCZ024835; Fri, 23 Jan 2015 00:54:57 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201501230054.t0N0svCZ024835@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Fri, 23 Jan 2015 00:54:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r277554 - stable/10/cddl/compat/opensolaris/misc X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Jan 2015 00:54:57 -0000 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;