From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13164 invoked by alias); 17 Jun 2004 11:51:11 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 13105 invoked from network); 17 Jun 2004 11:51:08 -0000 Received: from unknown (HELO dublin.act-europe.fr) (212.157.227.154) by sourceware.org with SMTP; 17 Jun 2004 11:51:08 -0000 Received: from localhost (province.act-europe.fr [10.10.0.214]) by filtered-dublin.act-europe.fr (Postfix) with ESMTP id DE9DF229FE7; Thu, 17 Jun 2004 13:51:07 +0200 (MET DST) Received: from dublin.act-europe.fr ([10.10.0.154]) by localhost (province.act-europe.fr [10.10.0.214]) (amavisd-new, port 10024) with ESMTP id 61508-06; Thu, 17 Jun 2004 13:51:07 +0200 (CEST) Received: from berne.act-europe.fr (berne.act-europe.fr [10.10.0.165]) by dublin.act-europe.fr (Postfix) with ESMTP id 9F96D229E63; Thu, 17 Jun 2004 13:51:07 +0200 (MET DST) Received: by berne.act-europe.fr (Postfix, from userid 560) id 53FA7592B; Thu, 17 Jun 2004 08:51:07 -0400 (EDT) Date: Thu, 17 Jun 2004 11:51:00 -0000 From: Jerome Guitton To: binutils@sources.redhat.com, gdb-patches@sources.redhat.com Subject: Re: [RFA] bfd_cache_close_all Message-ID: <20040617125107.GD8722@act-europe.fr> References: <20040616171748.GA8782@act-europe.fr> <20040617022241.GF3596@bubble.modra.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="ZPt4rx8FFjLCG7dd" Content-Disposition: inline In-Reply-To: <20040617022241.GF3596@bubble.modra.org> User-Agent: Mutt/1.4i X-Virus-Scanned: by amavisd-new at act-europe.fr X-SW-Source: 2004-06/txt/msg00407.txt.bz2 --ZPt4rx8FFjLCG7dd Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 247 Alan Modra (amodra@bigpond.net.au): > No need to close oldest first. OK with the following change to simplify > the code. > > while (bfd_last_cache != NULL) > ret &= bfd_cache_close (bfd_last_cache); Thanks. Patch committed. -- Jerome --ZPt4rx8FFjLCG7dd Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="bfd_cache_close_all.dif" Content-length: 2170 2004-06-17 Jerome Guitton * bfd-in.h (bfd_cache_close_all): New function declaration. * bfd-in2.h: Regenerate. * cache.c (bfd_cache_close_all): New function definition. Index: bfd-in.h =================================================================== RCS file: /cvs/src/src/bfd/bfd-in.h,v retrieving revision 1.81 diff -u -r1.81 bfd-in.h --- bfd-in.h 15 Jun 2004 01:24:22 -0000 1.81 +++ bfd-in.h 17 Jun 2004 10:34:24 -0000 @@ -511,6 +511,8 @@ (bfd *abfd); /* NB: This declaration should match the autogenerated one in libbfd.h. */ +extern bfd_boolean bfd_cache_close_all (void); + extern bfd_boolean bfd_record_phdr (bfd *, unsigned long, bfd_boolean, flagword, bfd_boolean, bfd_vma, bfd_boolean, bfd_boolean, unsigned int, struct bfd_section **); Index: bfd-in2.h =================================================================== RCS file: /cvs/src/src/bfd/bfd-in2.h,v retrieving revision 1.280 diff -u -r1.280 bfd-in2.h --- bfd-in2.h 15 Jun 2004 01:24:22 -0000 1.280 +++ bfd-in2.h 17 Jun 2004 10:34:24 -0000 @@ -518,6 +518,8 @@ (bfd *abfd); /* NB: This declaration should match the autogenerated one in libbfd.h. */ +extern bfd_boolean bfd_cache_close_all (void); + extern bfd_boolean bfd_record_phdr (bfd *, unsigned long, bfd_boolean, flagword, bfd_boolean, bfd_vma, bfd_boolean, bfd_boolean, unsigned int, struct bfd_section **); Index: cache.c =================================================================== RCS file: /cvs/src/src/bfd/cache.c,v retrieving revision 1.14 diff -u -r1.14 cache.c --- cache.c 5 May 2004 15:39:11 -0000 1.14 +++ cache.c 17 Jun 2004 10:34:25 -0000 @@ -344,6 +344,31 @@ } /* +FUNCTION + bfd_cache_close_all + +SYNOPSIS + bfd_boolean bfd_cache_close_all (void); + +DESCRIPTION + Remove all BFDs from the cache. If the attached file is open, + then close it too. + +RETURNS + <> is returned if closing one of the file fails, <> is + returned if all is well. +*/ + +bfd_boolean +bfd_cache_close_all () +{ + bfd_boolean ret = TRUE; + + while (bfd_last_cache != NULL) + ret &= bfd_cache_close (bfd_last_cache); +} + +/* INTERNAL_FUNCTION bfd_open_file --ZPt4rx8FFjLCG7dd--