Date: Sun, 17 Dec 2000 15:36:56 -0600 From: Chris Costello <chris@calldei.com> 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: <20001217153656.F54486@holly.calldei.com> In-Reply-To: <20001217153129.B63080@hamlet.nectar.com> References: <200012172110.eBHLAfU46563@freefall.freebsd.org> <20001217151509.A63051@hamlet.nectar.com> <20001217151735.D54486@holly.calldei.com> <20001217153129.B63080@hamlet.nectar.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sunday, December 17, 2000, Jacques A. Vidrine wrote:
> I don't blame authors of storage allocation code if they do not write
> free like this:
>
> void
> free(void *p)
> {
> if (p == NULL)
> return;
> .
> .
> .
>
>
> It would be silly to optimize for freeing NULL pointers.
You mean as seen in:
static void
ifree(void *ptr)
{
struct pginfo *info;
int index;
/* This is legal */
if (!ptr)
return;
.
.
.
called by free():
void
free(void *ptr)
{
THREAD_LOCK();
malloc_func = " in free():";
if (malloc_active++) {
wrtwarning("recursive call.\n");
malloc_active--;
return;
} else {
ifree(ptr);
.
.
.
That's how it's worked since before FreeBSD came into being.
It wasn't implemented the same, but it behaved the same.
--
+-------------------+----------------------------------------+
| Chris Costello | All the simple programs have been |
| chris@calldei.com | written, and all the good names taken. |
+-------------------+----------------------------------------+
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?20001217153656.F54486>
