From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21197 invoked by alias); 9 Sep 2009 17:38:38 -0000 Received: (qmail 21138 invoked by uid 22791); 9 Sep 2009 17:38:36 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.45.13) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 09 Sep 2009 17:38:32 +0000 Received: from wpaz29.hot.corp.google.com (wpaz29.hot.corp.google.com [172.24.198.93]) by smtp-out.google.com with ESMTP id n89HcUwo003559 for ; Wed, 9 Sep 2009 10:38:30 -0700 Received: from ywh15 (ywh15.prod.google.com [10.192.8.15]) by wpaz29.hot.corp.google.com with ESMTP id n89HcS9N013135 for ; Wed, 9 Sep 2009 10:38:28 -0700 Received: by ywh15 with SMTP id 15so1652620ywh.6 for ; Wed, 09 Sep 2009 10:38:28 -0700 (PDT) MIME-Version: 1.0 Received: by 10.150.169.18 with SMTP id r18mr958146ybe.111.1252517907922; Wed, 09 Sep 2009 10:38:27 -0700 (PDT) In-Reply-To: <8ac60eac0909091029r53400e01p985e6657522b5295@mail.gmail.com> References: <8ac60eac0909091029r53400e01p985e6657522b5295@mail.gmail.com> Date: Wed, 09 Sep 2009 17:38:00 -0000 Message-ID: Subject: Re: TYPE_NAME memory management From: Doug Evans To: Paul Pluzhnikov Cc: tromey@redhat.com, gdb@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-System-Of-Record: true X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2009-09/txt/msg00145.txt.bz2 On Wed, Sep 9, 2009 at 10:29 AM, Paul Pluzhnikov wr= ote: > On Wed, Sep 9, 2009 at 9:40 AM, Doug Evans wrote: > >> struct objfile_data >> { >> =A0 unsigned index; >> =A0 /* The objfile is about to be freed. =A0Save anything needed from it= . =A0*/ >> =A0 void (*save) (struct objfile *, void *); >> =A0 /* Free all objfile-related resources held. =A0*/ >> =A0 void (*free) (struct objfile *, void *); >> }; > > How about s/save/cleanup/ and s/free/destroy/: [fwiw] I chose to stay away from "cleanup" because cleanups in gdb have the connotation of freeing resources, which we want the cleanup in "cleanup/destroy" to explicitly not do. >> It would require adding a parameter to >> register_objfile_data_with_cleanup and updating all the callers. > > Perhaps a new 'register_objfile_data_with_cleanup_and_destroy' function > which register_objfile_data_with_cleanup can call with NULL as the destroy > parameter? Yeah, though given that I was explicitly staying away from "cleanup" in the name of the functions to call I chose to avoid this. [I don't mind "cleanup" appearing in register_objfile_data_with_cleanup because here it encompasses both the "save" and "free" routines.] > But then there are only 4 places which call it, so not a big deal to > update them all. Yeah, that was my thinking.