From owner-freebsd-hackers Sun Dec 17 13:38:20 2000 From owner-freebsd-hackers@FreeBSD.ORG Sun Dec 17 13:38:18 2000 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mta4.rcsntx.swbell.net (mta4.rcsntx.swbell.net [151.164.30.28]) by hub.freebsd.org (Postfix) with ESMTP id 12C2337B400 for ; Sun, 17 Dec 2000 13:38:18 -0800 (PST) Received: from holly.dyndns.org ([208.191.149.190]) by mta4.rcsntx.swbell.net (Sun Internet Mail Server sims.3.5.2000.01.05.12.18.p9) with ESMTP id <0G5Q00BK1EQQOM@mta4.rcsntx.swbell.net> for hackers@FreeBSD.ORG; Sun, 17 Dec 2000 15:37:39 -0600 (CST) Received: (from chris@localhost) by holly.dyndns.org (8.9.3/8.9.3) id PAA56956; Sun, 17 Dec 2000 15:36:57 -0600 (CST envelope-from chris) Date: Sun, 17 Dec 2000 15:36:56 -0600 From: Chris Costello Subject: Re: Why not another style thread? (was Re: cvs commit: src/lib/libc/gen getgrent.c) In-reply-to: <20001217153129.B63080@hamlet.nectar.com> To: "Jacques A. Vidrine" Cc: hackers@FreeBSD.ORG Reply-To: chris@calldei.com Message-id: <20001217153656.F54486@holly.calldei.com> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii User-Agent: Mutt/0.96.4i References: <200012172110.eBHLAfU46563@freefall.freebsd.org> <20001217151509.A63051@hamlet.nectar.com> <20001217151735.D54486@holly.calldei.com> <20001217153129.B63080@hamlet.nectar.com> Sender: chris@holly.dyndns.org Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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