Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 17 Dec 2000 21:59:30 -0700
From:      Warner Losh <imp@village.org>
To:        "Jacques A. Vidrine" <n@nectar.com>
Cc:        hackers@FreeBSD.ORG
Subject:   Re: Why not another style thread? (was Re: cvs commit: src/lib/libc/gen getgrent.c) 
Message-ID:  <200012180459.VAA87790@harmony.village.org>
In-Reply-To: Your message of "Sun, 17 Dec 2000 15:15:09 CST." <20001217151509.A63051@hamlet.nectar.com> 
References:  <20001217151509.A63051@hamlet.nectar.com>  <200012172110.eBHLAfU46563@freefall.freebsd.org> 

next in thread | previous in thread | raw e-mail | index | archive | help
In message <20001217151509.A63051@hamlet.nectar.com> "Jacques A. Vidrine" writes:
: 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);

Number 2.  ANSI-C (aka c89) requires that free(NULL) work.  We
shouldn't go out of our way to pander to those machines where it
doesn't.

Number 1 is my second choice assuming for some reason number 2 isn't
an option.

Number 3 is the same as #2, imho, except that it gratuioutsly uglifies 
the code by the introduction of a non-standard API and an additional
macro.

Warner


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?200012180459.VAA87790>