aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdb_bfd.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2020-09-19 11:54:49 -0600
committerTom Tromey <tom@tromey.com>2020-09-19 11:54:50 -0600
commit1ce51eb52dca2fcd1ad4120876362ce2a53b3de6 (patch)
tree2230d03928cd5205c1cc1eef76aaef48063172fc /gdb/gdb_bfd.c
parenta190fabbfc6cca47d572550419f80c55802f3056 (diff)
downloadgdb-1ce51eb52dca2fcd1ad4120876362ce2a53b3de6.zip
gdb-1ce51eb52dca2fcd1ad4120876362ce2a53b3de6.tar.gz
gdb-1ce51eb52dca2fcd1ad4120876362ce2a53b3de6.tar.bz2
Use gdb_bfd_sections in gdb_bfd_close_or_warn
This changes gdb_bfd_close_or_warn to avoid bfd_map_over_sections, in favor of iteration. gdb/ChangeLog 2020-09-19 Tom Tromey <tom@tromey.com> * gdb_bfd.c (free_one_bfd_section): Remove 'abfd' and 'ignore' parameters. (gdb_bfd_close_or_warn): Use foreach.
Diffstat (limited to 'gdb/gdb_bfd.c')
-rw-r--r--gdb/gdb_bfd.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/gdb/gdb_bfd.c b/gdb/gdb_bfd.c
index 58d177c..0639438 100644
--- a/gdb/gdb_bfd.c
+++ b/gdb/gdb_bfd.c
@@ -507,7 +507,7 @@ gdb_bfd_open (const char *name, const char *target, int fd,
BFD. */
static void
-free_one_bfd_section (bfd *abfd, asection *sectp, void *ignore)
+free_one_bfd_section (asection *sectp)
{
struct gdb_bfd_section_data *sect
= (struct gdb_bfd_section_data *) bfd_section_userdata (sectp);
@@ -536,7 +536,8 @@ gdb_bfd_close_or_warn (struct bfd *abfd)
int ret;
const char *name = bfd_get_filename (abfd);
- bfd_map_over_sections (abfd, free_one_bfd_section, NULL);
+ for (asection *sect : gdb_bfd_sections (abfd))
+ free_one_bfd_section (sect);
ret = bfd_close (abfd);