From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jim Meyering Newsgroups: gmane.emacs.devel Subject: Re: emacs' turn: remove useless if-before-free tests Date: Fri, 13 Jun 2008 00:54:50 +0200 Message-ID: <87fxril0w5.fsf@rho.meyering.net> References: <87fxryjv2n.fsf@rho.meyering.net> <87abi4fjnp.fsf@rho.meyering.net> <20080608105325.GB42765@orion.lan> <87prqscdlg.fsf@rho.meyering.net> <87ej751t9f.fsf@rho.meyering.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1213311314 9964 80.91.229.12 (12 Jun 2008 22:55:14 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 12 Jun 2008 22:55:14 +0000 (UTC) Cc: Stefan Monnier , Emacs development discussions To: Emanuele Giaquinta Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jun 13 00:55:57 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 1K6vhs-0006rC-SR for ged-emacs-devel@m.gmane.org; Fri, 13 Jun 2008 00:55:49 +0200 Original-Received: from localhost ([127.0.0.1]:52343 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K6vh5-0003cG-6a for ged-emacs-devel@m.gmane.org; Thu, 12 Jun 2008 18:54:59 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K6vh0-0003Ze-3j for emacs-devel@gnu.org; Thu, 12 Jun 2008 18:54:54 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K6vgy-0003YH-N2 for emacs-devel@gnu.org; Thu, 12 Jun 2008 18:54:53 -0400 Original-Received: from [199.232.76.173] (port=53668 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K6vgy-0003Xy-FY for emacs-devel@gnu.org; Thu, 12 Jun 2008 18:54:52 -0400 Original-Received: from smtp3-g19.free.fr ([212.27.42.29]:58139) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1K6vgy-00049w-35 for emacs-devel@gnu.org; Thu, 12 Jun 2008 18:54:52 -0400 Original-Received: from smtp3-g19.free.fr (localhost.localdomain [127.0.0.1]) by smtp3-g19.free.fr (Postfix) with ESMTP id 64AC917B53E for ; Fri, 13 Jun 2008 00:54:51 +0200 (CEST) Original-Received: from mx.meyering.net (mx.meyering.net [82.230.74.64]) by smtp3-g19.free.fr (Postfix) with ESMTP id 4FEF517B539 for ; Fri, 13 Jun 2008 00:54:51 +0200 (CEST) Original-Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id F3E3834A9A; Fri, 13 Jun 2008 00:54:50 +0200 (CEST) In-Reply-To: <87ej751t9f.fsf@rho.meyering.net> (Jim Meyering's message of "Tue, 10 Jun 2008 12:25:32 +0200") Original-Lines: 47 X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) 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:99050 Archived-At: Jim Meyering wrote: > Jim Meyering wrote: >> Emanuele Giaquinta wrote: >>> On Mon, Jun 02, 2008 at 08:14:18AM +0200, Jim Meyering wrote: >>> >>>> Stefan Monnier wrote: >>>> > Sounds like a good cleanup. >>>> > Feel free to install it unless there's a strong objection. >>>> >>>> Thanks. I've committed those three change sets. >>> >>> This patch introduced a problem on os x, free on os x is redirected to >>> unexmacosx.c:unexec_free, which does not support a NULL argument in an >>> undumped emacs. The attached patch changes the problematic free call to >>> xfree, as done a few lines below for another pointer. >>> >>> Emanuele >>> >>> diff --git a/src/lread.c b/src/lread.c >>> index e5e77bc..3e0bd1f 100644 >>> --- a/src/lread.c >>> +++ b/src/lread.c >>> @@ -1269,7 +1269,7 @@ Return t if the file exists and loads successfully. */) >>> >>> UNGCPRO; >>> >>> - free (saved_doc_string); >>> + xfree (saved_doc_string); >>> saved_doc_string = 0; >>> saved_doc_string_size = 0; >> >> Thanks for catching and fixing that. >> If using xfree (with its MALLOC_BLOCK_INPUT guard) is important there, >> as it seems to be, then your patch also fixes a platform-independent >> race condition bug. >> >> The following change is probably a good idea, too. >> It makes unexec_free (NULL) a no-op, just like free (NULL) is: >> >> 2008-06-08 Jim Meyering >> >> make unexec_free handle NULL the same way free does >> * unexmacosx.c (unexec_free): Ignore a NULL argument. > > If no one objects soon, I'll commit both our changes. Done.