From 64b2d4a0a4e4f80d2aa2e52c6eec3186e76fc397 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sun, 8 Sep 2019 11:38:24 -0600 Subject: Introduce bfd_set_filename This introduces a new bfd_set_filename function, which is then used in various spots in gdb. This allows for the removal of some casts. bfd/ChangeLog 2019-09-11 Tom Tromey * opncls.c (bfd_set_filename): New function. * bfd-in2.h: Regenerate. gdb/ChangeLog 2019-09-11 Tom Tromey * symfile-mem.c (symbol_file_add_from_memory): Use bfd_set_filename. * solib-darwin.c (darwin_bfd_open): Use bfd_set_filename. * solib-aix.c (solib_aix_bfd_open): Use bfd_set_filename. --- bfd/opncls.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'bfd/opncls.c') diff --git a/bfd/opncls.c b/bfd/opncls.c index 07f89b9..d14dfe9 100644 --- a/bfd/opncls.c +++ b/bfd/opncls.c @@ -2089,3 +2089,23 @@ bfd_follow_build_id_debuglink (bfd *abfd, const char *dir) get_build_id_name, check_build_id_file, &build_id); } + +/* +FUNCTION + bfd_set_filename + +SYNOPSIS + void bfd_set_filename (bfd *abfd, char *filename); + +DESCRIPTION + Set the filename of @var{abfd}. The old filename, if any, is freed. + @var{filename} must be allocated using @code{xmalloc}. After + this call, it is owned @var{abfd}. +*/ + +void +bfd_set_filename (bfd *abfd, char *filename) +{ + free ((char *) abfd->filename); + abfd->filename = filename; +} -- cgit v1.1