Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 17 Dec 2000 16:25:55 -0500 (EST)
From:      Bosko Milekic <bmilekic@technokratis.com>
To:        Chris Costello <chris@calldei.com>
Cc:        "Jacques A. Vidrine" <n@nectar.com>, hackers@FreeBSD.ORG
Subject:   Re: Why not another style thread? (was Re: cvs commit: src/lib/libc/gen getgrent.c)
Message-ID:  <Pine.BSF.4.21.0012171624260.533-100000@jehovah.technokratis.com>
In-Reply-To: <20001217151735.D54486@holly.calldei.com>

next in thread | previous in thread | raw e-mail | index | archive | help

On Sun, 17 Dec 2000, Chris Costello wrote:

> On Sunday, December 17, 2000, Jacques A. Vidrine wrote:
> > What do folks think about
> > 
> >   1)    if (data)
> >                 free(data);
> > 
> > versus
> > 
> >   2)    free(data);
> > 
> > versus
> > 
> >   3)    #define xfree(x) if ((x) != NULL) free(x);
> >         xfree(data);
> 
>    2.  The C standard dictates that free() does nothing when it
> gets a NULL argument.  The other two are just extra clutter.

	Agreed. However, in the kernel, all free()s should be made as in (1),
  in my opinion. (2) is dangerous, and (3) would just obfuscate the code.
  (I know this does not apply to the commit, but should be noted)

> -- 
> +-------------------+-------------------------------------------------+
> | Chris Costello    | This system will self-destruct in five minutes. |
> | chris@calldei.com |                                                 |
> +-------------------+-------------------------------------------------+

  Later,
  Bosko Milekic
  bmilekic@technokratis.com




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0012171624260.533-100000>