[RFA] bfd_cache_close_all
Jerome Guitton
guitton@act-europe.fr
Thu Jun 17 11:51:00 GMT 2004
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
-------------- next part --------------
2004-06-17 Jerome Guitton <guitton@gnat.com>
* 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
+ <<FALSE>> is returned if closing one of the file fails, <<TRUE>> 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
More information about the Gdb-patches
mailing list