Skip site navigation (1)Skip section navigation (2)
Date:      18 Dec 2000 03:04:55 +0100
From:      assar@FreeBSD.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:  <5l66kia3i0.fsf@assaris.sics.se>
In-Reply-To: "Jacques A. Vidrine"'s message of "Sun, 17 Dec 2000 15:15:09 -0600"
References:  <200012172110.eBHLAfU46563@freefall.freebsd.org> <20001217151509.A63051@hamlet.nectar.com>

next in thread | previous in thread | raw e-mail | index | archive | help
"Jacques A. Vidrine" <n@nectar.com> 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);

(2), unless you can show that you actually win something by the
optimization in (1), and if you repeat it enough I would vote for
doing an inline function similar to the one in (3).

This is of course for user-level free since kernel free has different
parameters.

/assar


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?5l66kia3i0.fsf>