In message <404d743b-735b-0605-5ab5-ccb95ce24...@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.v1r0a1wm074...@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 <cy.schub...@cschubert.com>
FreeBSD UNIX:  <c...@freebsd.org>   Web:  http://www.FreeBSD.org

        The need of the many outweighs the greed of the few.


_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to