From owner-svn-src-head@freebsd.org Mon Feb 27 02:37:33 2017 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 E92FECEFEF4; Mon, 27 Feb 2017 02:37:33 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from smtp-out-so.shaw.ca (smtp-out-so.shaw.ca [64.59.136.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id A00EAC4D; Mon, 27 Feb 2017 02:37:33 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from spqr.komquats.com ([96.50.22.10]) by shaw.ca with SMTP id iBBrcPosGC3JIiBBscv2Ww; Sun, 26 Feb 2017 19:37:32 -0700 X-Authority-Analysis: v=2.2 cv=XbT59Mx5 c=1 sm=1 tr=0 a=jvE2nwUzI0ECrNeyr98KWA==:117 a=jvE2nwUzI0ECrNeyr98KWA==:17 a=kj9zAlcOel0A:10 a=n2v9WMKugxEA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=wR5-japwTx45AJySfSsA:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id E5739216; Sun, 26 Feb 2017 18:37:30 -0800 (PST) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id v1R2bSsC004156; Sun, 26 Feb 2017 18:37:28 -0800 (PST) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201702270237.v1R2bSsC004156@slippy.cwsent.com> X-Mailer: exmh version 2.8.0 04/21/2012 with nmh-1.6 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Pedro Giffuni cc: Cy Schubert , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r314322 - head/lib/librss In-Reply-To: Message from Pedro Giffuni of "Sun, 26 Feb 2017 21:27:48 -0500." <404d743b-735b-0605-5ab5-ccb95ce24ad8@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sun, 26 Feb 2017 18:37:28 -0800 X-CMAE-Envelope: MS4wfFluleE7ctIQEzzK+dh6vrSP+tBoUT72OAPtQBKuGPJO54E5/gCqGAOeHUQpvlasg+P3vfAVxFNkGNPB7Xf+bVbgYGKwZlp6323V/geltCy1DgwQuJQo C7XiSqg0VmG3X75MtdERaTUocoS8u+Nx/np8eXWc6z3AoXjK+UDqUzoWMBk8uSLTWHt5higIY2Rk0CcpeFNG3MAcBt8o4s8qy22O6u2ctf0AQvmHhtr821wO ULvT1RRQCuLUW/Qc7q58RBOexbBAWTpO9piFavFgROjqE/EkrrShOm6IDimPZZLU X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 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: Mon, 27 Feb 2017 02:37:34 -0000 In message <404d743b-735b-0605-5ab5-ccb95ce24ad8@FreeBSD.org>, Pedro Giffuni wr ites: > This is a multi-part message in MIME format. > --------------C3FC59CAC7D072A09BF70AAF > Content-Type: text/plain; charset=windows-1252; format=flowed > Content-Transfer-Encoding: 7bit > > Hello; > > On 2/26/2017 8:51 PM, Cy Schubert wrote: > > In message <201702270010.v1R0A1wm074123@repo.freebsd.org>, "Pedro F. > > Giffuni" w > > rites: > >> Author: pfg > >> Date: Mon Feb 27 00:10:00 2017 > >> New Revision: 314322 > >> URL: https://svnweb.freebsd.org/changeset/base/314322 > >> > >> Log: > >> librss: simplify some NULL checks. > >> > >> MFC after: 1 week > >> > >> Modified: > >> head/lib/librss/librss.c > >> > >> Modified: head/lib/librss/librss.c > >> ========================================================================== > === > >> = > >> --- head/lib/librss/librss.c Sun Feb 26 22:17:06 2017 (r31432 > 1) > >> +++ head/lib/librss/librss.c Mon Feb 27 00:10:00 2017 (r31432 > 2) > >> @@ -244,10 +244,10 @@ rss_config_get(void) > >> return (rc); > >> > >> error: > >> - if ((rc != NULL) && rc->rss_bucket_map) > >> + if (rc != NULL) { > >> free(rc->rss_bucket_map); > > What happens if rc is not NULL and rc->rss_bucket_map is NULL? > > According the free(3): " If /ptr/ is *NULL*, no action occurs." > Good point. Then why even test for RC being NULL? The only reason I can think of doing any test for NULL before free(3) is that if the likelihood of *ptr being NULL is greater than the likelihood of *ptr not being NULL then you save running the extra instructions to make that determination in free(), e.g. pushes, call, return, pops. -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few.