From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30850 invoked by alias); 29 Jun 2007 11:34:45 -0000 Received: (qmail 30837 invoked by uid 22791); 29 Jun 2007 11:34:44 -0000 X-Spam-Check-By: sourceware.org Received: from NaN.false.org (HELO nan.false.org) (208.75.86.248) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 29 Jun 2007 11:34:40 +0000 Received: from nan.false.org (localhost [127.0.0.1]) by nan.false.org (Postfix) with ESMTP id 8F4A6982A3; Fri, 29 Jun 2007 11:34:38 +0000 (GMT) Received: from caradoc.them.org (22.svnf5.xdsl.nauticom.net [209.195.183.55]) by nan.false.org (Postfix) with ESMTP id 52D2D982A2; Fri, 29 Jun 2007 11:34:38 +0000 (GMT) Received: from drow by caradoc.them.org with local (Exim 4.67) (envelope-from ) id 1I4Ejn-0003ZK-P4; Fri, 29 Jun 2007 07:34:07 -0400 Date: Fri, 29 Jun 2007 11:37:00 -0000 From: Daniel Jacobowitz To: msnyder@sonic.net Cc: Michael Snyder , gdb-patches@sourceware.org Subject: Re: [OB] Add cleanup, source.c Message-ID: <20070629113407.GA13561@caradoc.them.org> Mail-Followup-To: msnyder@sonic.net, Michael Snyder , gdb-patches@sourceware.org References: <9270.12.7.175.2.1183069663.squirrel@webmail.sonic.net> <20070628224815.GC12578@caradoc.them.org> <655C3D4066B7954481633935A40BB36F041427@ussunex02.svl.access-company.com> <20070628231153.GA14231@caradoc.them.org> <11470.12.7.175.2.1183080998.squirrel@webmail.sonic.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <11470.12.7.175.2.1183080998.squirrel@webmail.sonic.net> User-Agent: Mutt/1.5.15 (2007-04-09) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2007-06/txt/msg00525.txt.bz2 On Thu, Jun 28, 2007 at 06:36:38PM -0700, msnyder@sonic.net wrote: > > No, that's not right. Cleanups are often discarded after a successful > > operation, in order to not free something that would have been cleaned > > up on error. > > Well, I'm pretty sure you're mistaken. We're both right. Cleanups do get discarded, and cleanups that aren't discarded are called at the top level. Every cleanup I've written since I started working on GDB at 2001 has been freed locally rather than at the top level, though. I think it's very confusing if the cleanups are not locally paired. >From gdbint.texinfo: Your function should explicitly do or discard the cleanups it creates. Failing to do this leads to non-deterministic behavior since the caller will arbitrarily do or discard your functions cleanups. This need leads to two common cleanup styles. > 3) By example: in the same module (source.c), three other functions > call buildargv and make_cleanup_freeargv -- and none of them calls > do_cleanups. > > So you're holding me to a higher standard than the preexisting code. > ;-) True. There are several functions that do though. Well, I'll stop objecting now :-) -- Daniel Jacobowitz CodeSourcery