From owner-svn-src-head@freebsd.org Fri May 20 17:52:20 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B5F36B44722 for ; Fri, 20 May 2016 17:52:20 +0000 (UTC) (envelope-from scott4long@yahoo.com) Received: from nm30-vm6.bullet.mail.gq1.yahoo.com (nm30-vm6.bullet.mail.gq1.yahoo.com [98.136.216.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 91C2B1818 for ; Fri, 20 May 2016 17:52:20 +0000 (UTC) (envelope-from scott4long@yahoo.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1463766367; bh=iepk9OJGKDFD59oYxZG7lpwrS5VAE2CyPreeF5yxGbo=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From:Subject; b=PP34c5cMFjuGh2purvFTn9XzGwjcyUU8gWnzzlVmirAe79kfEUWWdUGVFMrsQcV/Y5q4oArwX0OJVUOQct1om5igumJVCnz77Drp/l7ZPpV/UvM5FFWK4dc71/VD/iK+M3B21jSEuhRlVh3TkUGTi7fLF2y+0yiLjkFDdS935AjttGs6yqxs7wqVwMEapOu8cHa0jEkjYuL7SJOv1bWI/+lvhkiKYPlN7x7tluCLiayeSn39hYN6pQdz3YdT4T4qgM1gYeK8YXGctWv1O4MUelZ4EivXGLqVVA7db9huTflZ1Bl/liBOMnYyAnPS6nXPaq5lyKcqtEOH233wx7tcbw== Received: from [98.137.12.57] by nm30.bullet.mail.gq1.yahoo.com with NNFMP; 20 May 2016 17:46:07 -0000 Received: from [98.136.164.64] by tm2.bullet.mail.gq1.yahoo.com with NNFMP; 20 May 2016 17:46:07 -0000 Received: from [127.0.0.1] by smtp226.mail.gq1.yahoo.com with NNFMP; 20 May 2016 17:46:07 -0000 X-Yahoo-Newman-Id: 492191.52307.bm@smtp226.mail.gq1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: TupZuyYVM1mROoTnDSmUTQ6o7oVQq.z9eMxtOu5k_txKTpl U4JuOzYUr2niusCSQSBZ1ojaKG1i16zNJ.a..GF9D0FUgTfFMNXjF7F8SoON xNlXv9yMXmfaI.lNSW.kbM12zyIjvNsG.Cr6GNkvRz0AcjbgMY7Jm1rxcAQI gMP0MFaV60vl7Ndy1l3w8wMDP7pKO.AsgPNLl8d4W0VTJIJc4dDnV.DQdnYW d84RZmKX36NILFdq6t_o_u4cqk3A5aMZNMOZhpBX4mveg66oprgHs1K0I701 k7YUShKFTzJPRDDiOBMd1lWWQwWk0iZsCZBQixhFG88G3Oe8jK5xz5C0k_3t ITOA6X4DzgcELx6VXWiqZsiFDIxYxFCl0g3y83NZ6.Rnbmef3J.CiYiHK21E iDDoBNO0fJkLm3Y26miO4fReLOgUakZRmaXXLhtFYws1nIC8TQZgUn0H39W7 yUKxpm9E7BpFcDc37mKnarMSd56vG5WHzxBPzK77xCQ_Yq7VsVq.kLdssHV. iLRIV.GIZnsAZXAPK6fyW56IHifC2AptGyrIlvUE- X-Yahoo-SMTP: clhABp.swBB7fs.LwIJpv3jkWgo2NU8- Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: Re: svn commit: r300219 - in head/sys: kern sys From: Scott Long In-Reply-To: <4596681286066293430@unknownmsgid> Date: Fri, 20 May 2016 11:46:04 -0600 Cc: Scott Long , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: <20F58791-903E-48A1-A57C-D28ED10ABEBC@yahoo.com> References: <201605191714.u4JHEOnn037348@repo.freebsd.org> <4596681286066293430@unknownmsgid> To: Steven Hartland X-Mailer: Apple Mail (2.3124) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 May 2016 17:52:20 -0000 Yeah, I was following existing style. Feel free to fix up if you like. Scott > On May 19, 2016, at 12:51 PM, Steven Hartland = wrote: >=20 > I thought it was considered better to use if (var =3D=3D NULL) instead = of > if (!var) for pointers as they aren't bools? >=20 >> On 19 May 2016, at 18:14, Scott Long wrote: >>=20 >> Author: scottl >> Date: Thu May 19 17:14:24 2016 >> New Revision: 300219 >> URL: https://svnweb.freebsd.org/changeset/base/300219 >>=20 >> Log: >> Adjust the creation of tq_name so it can be freed correctly >>=20 >> Reviewed by: jhb, allanjude >> Differential Revision: D6454 >>=20 >> Modified: >> head/sys/kern/subr_taskqueue.c >> head/sys/sys/taskqueue.h >>=20 >> Modified: head/sys/kern/subr_taskqueue.c >> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >> --- head/sys/kern/subr_taskqueue.c Thu May 19 17:02:33 2016 = (r300218) >> +++ head/sys/kern/subr_taskqueue.c Thu May 19 17:14:24 2016 = (r300219) >> @@ -128,16 +128,17 @@ _taskqueue_create(const char *name, int >> int mtxflags, const char *mtxname __unused) >> { >> struct taskqueue *queue; >> - char *tq_name =3D NULL; >> + char *tq_name; >>=20 >> - if (name !=3D NULL) >> - tq_name =3D strndup(name, 32, M_TASKQUEUE); >> - if (tq_name =3D=3D NULL) >> - tq_name =3D "taskqueue"; >> + tq_name =3D malloc(TASKQUEUE_NAMELEN, M_TASKQUEUE, mflags | = M_ZERO); >> + if (!tq_name) >> + return (NULL); >> + >> + snprintf(tq_name, TASKQUEUE_NAMELEN, "%s", (name) ? name : = "taskqueue"); >>=20 >> queue =3D malloc(sizeof(struct taskqueue), M_TASKQUEUE, mflags | = M_ZERO); >> if (!queue) >> - return NULL; >> + return (NULL); >>=20 >> STAILQ_INIT(&queue->tq_queue); >> TAILQ_INIT(&queue->tq_active); >> @@ -153,7 +154,7 @@ _taskqueue_create(const char *name, int >> queue->tq_flags |=3D TQ_FLAGS_UNLOCKED_ENQUEUE; >> mtx_init(&queue->tq_mutex, tq_name, NULL, mtxflags); >>=20 >> - return queue; >> + return (queue); >> } >>=20 >> struct taskqueue * >>=20 >> Modified: head/sys/sys/taskqueue.h >> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >> --- head/sys/sys/taskqueue.h Thu May 19 17:02:33 2016 (r300218) >> +++ head/sys/sys/taskqueue.h Thu May 19 17:14:24 2016 (r300219) >> @@ -56,6 +56,7 @@ enum taskqueue_callback_type { >> #define TASKQUEUE_CALLBACK_TYPE_MIN = TASKQUEUE_CALLBACK_TYPE_INIT >> #define TASKQUEUE_CALLBACK_TYPE_MAX = TASKQUEUE_CALLBACK_TYPE_SHUTDOWN >> #define TASKQUEUE_NUM_CALLBACKS TASKQUEUE_CALLBACK_TYPE_MAX = + 1 >> +#define TASKQUEUE_NAMELEN 32 >>=20 >> typedef void (*taskqueue_callback_fn)(void *context); >>=20 >>=20 >=20