From owner-freebsd-hackers Sun Dec 17 20:59:35 2000 From owner-freebsd-hackers@FreeBSD.ORG Sun Dec 17 20:59:33 2000 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from rover.village.org (rover.village.org [204.144.255.66]) by hub.freebsd.org (Postfix) with ESMTP id AE14A37B400 for ; Sun, 17 Dec 2000 20:59:32 -0800 (PST) Received: from harmony.village.org (harmony.village.org [10.0.0.6]) by rover.village.org (8.11.0/8.11.0) with ESMTP id eBI4xUs05478; Sun, 17 Dec 2000 21:59:31 -0700 (MST) (envelope-from imp@harmony.village.org) Received: from harmony.village.org (localhost.village.org [127.0.0.1]) by harmony.village.org (8.9.3/8.8.3) with ESMTP id VAA87790; Sun, 17 Dec 2000 21:59:30 -0700 (MST) Message-Id: <200012180459.VAA87790@harmony.village.org> To: "Jacques A. Vidrine" Subject: Re: Why not another style thread? (was Re: cvs commit: src/lib/libc/gen getgrent.c) Cc: hackers@FreeBSD.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> Date: Sun, 17 Dec 2000 21:59:30 -0700 From: Warner Losh Sender: imp@harmony.village.org Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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