From 077b044d629319cd721afa87329f6dd93f6570e2 Mon Sep 17 00:00:00 2001 From: Jerome Guitton Date: Thu, 17 Jun 2004 11:47:51 +0000 Subject: [PATCH] * bfd-in.h (bfd_cache_close_all): New function declaration. * bfd-in2.h: Regenerate. * cache.c (bfd_cache_close_all): New function definition. --- bfd/ChangeLog | 6 ++++++ bfd/bfd-in.h | 2 ++ bfd/bfd-in2.h | 2 ++ bfd/cache.c | 25 +++++++++++++++++++++++++ 4 files changed, 35 insertions(+) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index abaaf7a32e..d475a27c63 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +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. + 2004-06-16 Mark Kettenis * configure.in: Don't set COREFILE to trad-core.lo for FreeBSD diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h index cbf7e931ed..5f98164cba 100644 --- a/bfd/bfd-in.h +++ b/bfd/bfd-in.h @@ -511,6 +511,8 @@ extern bfd_boolean bfd_cache_close (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 **); diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index 851fe4738e..87dd250d67 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -518,6 +518,8 @@ extern bfd_boolean bfd_cache_close (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 **); diff --git a/bfd/cache.c b/bfd/cache.c index 58eda916bb..63d4d786ae 100644 --- a/bfd/cache.c +++ b/bfd/cache.c @@ -344,6 +344,31 @@ bfd_cache_close (bfd *abfd) } /* +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 -- 2.11.0