From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Miles Bader Newsgroups: gmane.emacs.devel Subject: Re: emacs' turn: remove useless if-before-free tests Date: Mon, 02 Jun 2008 11:05:55 +0900 Message-ID: References: <87fxryjv2n.fsf@rho.meyering.net> Reply-To: Miles Bader NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1212372420 17979 80.91.229.12 (2 Jun 2008 02:07:00 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 2 Jun 2008 02:07:00 +0000 (UTC) Cc: Emacs development discussions , Stefan Monnier , Jim Meyering To: YAMAMOTO Mitsuharu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jun 02 04:07:41 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1K2zSU-0002jr-SR for ged-emacs-devel@m.gmane.org; Mon, 02 Jun 2008 04:07:39 +0200 Original-Received: from localhost ([127.0.0.1]:59401 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K2zRh-00071o-J2 for ged-emacs-devel@m.gmane.org; Sun, 01 Jun 2008 22:06:49 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K2zR1-0006Wl-3F for emacs-devel@gnu.org; Sun, 01 Jun 2008 22:06:07 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K2zQz-0006UM-0t for emacs-devel@gnu.org; Sun, 01 Jun 2008 22:06:06 -0400 Original-Received: from [199.232.76.173] (port=37193 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K2zQy-0006UB-R7 for emacs-devel@gnu.org; Sun, 01 Jun 2008 22:06:04 -0400 Original-Received: from tyo201.gate.nec.co.jp ([202.32.8.193]:48975) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1K2zQu-0002VS-Rr; Sun, 01 Jun 2008 22:06:01 -0400 Original-Received: from relay31.aps.necel.com ([10.29.19.54]) by tyo201.gate.nec.co.jp (8.13.8/8.13.4) with ESMTP id m5225bkB024322; Mon, 2 Jun 2008 11:05:56 +0900 (JST) Original-Received: from relay11.aps.necel.com ([10.29.19.20] [10.29.19.20]) by relay31.aps.necel.com with ESMTP; Mon, 2 Jun 2008 11:05:55 +0900 Original-Received: from dhapc248.dev.necel.com ([10.114.112.215] [10.114.112.215]) by relay11.aps.necel.com with ESMTP; Mon, 2 Jun 2008 11:05:55 +0900 Original-Received: by dhapc248.dev.necel.com (Postfix, from userid 31295) id 94ACE4CF; Mon, 2 Jun 2008 11:05:55 +0900 (JST) System-Type: i686-pc-linux-gnu Blat: Foop In-Reply-To: (YAMAMOTO Mitsuharu's message of "Mon, 02 Jun 2008 09:56:56 +0900") Original-Lines: 19 X-detected-kernel: by monty-python.gnu.org: Solaris 8 (1) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:98203 Archived-At: YAMAMOTO Mitsuharu writes: > I guess the acceptance of NULL for `free' in POSIX is the reflection > of the fact that `malloc' may return NULL. If so, we could take a > different policy for `xfree', i.e., abort if NULL, because `xmalloc' > may not return NULL unlike malloc. This may help us detect the > behavior that is different from programmer's intention. xmalloc can return NULL. I think xmalloc and xfree should act as much like posix malloc/free as possible, modulo the error-handling behavior of xmalloc. That will be the least surprising to programmers using them. Indeed, we can make them act like the posix function even on systems whose native malloc is less so. -Miles -- Yo mama's so fat when she gets on an elevator it HAS to go down.