From: Tom Tromey Date: Mon, 2 Mar 2026 16:26:20 +0000 (-0700) Subject: Use gdb_bfd_openr in corelow.c X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ec63f5532025bbf0f606dfcbea6d0818232e0461;p=thirdparty%2Fbinutils-gdb.git Use gdb_bfd_openr in corelow.c corelow.c has a couple of calls to bfd_openr, each followed by a call to new_reference. It's cleaner to use the provided gdb_bfd_openr wrapper. Reviewed-By: Keith Seitz --- diff --git a/gdb/corelow.c b/gdb/corelow.c index a28a707c293..84f44bc680e 100644 --- a/gdb/corelow.c +++ b/gdb/corelow.c @@ -451,10 +451,7 @@ core_target::build_file_mappings () gdb_bfd_ref_ptr abfd; if (expanded_fname != nullptr && !build_id_mismatch) - { - struct bfd *b = bfd_openr (expanded_fname.get (), "binary"); - abfd = gdb_bfd_ref_ptr::new_reference (b); - } + abfd = gdb_bfd_openr (expanded_fname.get (), "binary"); if ((expanded_fname == nullptr || abfd == nullptr @@ -474,9 +471,8 @@ core_target::build_file_mappings () type. */ expanded_fname = make_unique_xstrdup (bfd_get_filename (abfd.get ())); - struct bfd *b = bfd_openr (expanded_fname.get (), "binary"); - gdb_assert (b != nullptr); - abfd = gdb_bfd_ref_ptr::new_reference (b); + abfd = gdb_bfd_openr (expanded_fname.get (), "binary"); + gdb_assert (abfd != nullptr); } }