]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Cleanup bfd_close() cleanups.
authorAndrew Cagney <cagney@redhat.com>
Tue, 16 May 2000 02:43:39 +0000 (02:43 +0000)
committerAndrew Cagney <cagney@redhat.com>
Tue, 16 May 2000 02:43:39 +0000 (02:43 +0000)
gdb/ChangeLog
gdb/corelow.c
gdb/defs.h
gdb/remote-e7000.c
gdb/remote-udi.c
gdb/sparcl-tdep.c
gdb/symfile.c
gdb/utils.c

index f8342fa46c05349e20c0b704974d0da163b691d4..085add8863888b76dbd30a7fdab9d42bd4207b9f 100644 (file)
@@ -1,3 +1,13 @@
+Tue May 16 10:54:55 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+       * defs.h (make_cleanup_bfd_close): Add declaration.
+       * utils.c (do_bfd_close_cleanup, make_cleanup_bfd_close): New
+       functions.
+
+       * symfile.c (generic_load), sparcl-tdep.c (download), remote-udi.c
+       (download), remote-e7000.c (e7000_load), corelow.c (core_open,
+       core_file_to_sym_file): Replace calls to make_cleanup.
+
 Mon May 15 16:50:45 2000  Andrew Cagney  <cagney@b1.cygnus.com>
 
        * TODO: Add notes on register cache.
index adcfe90df19d0c71009fd8beac9a9a7d6500cf0c..6cdf0d7497f23aa8900ba6000db9e6de705f8884 100644 (file)
@@ -295,7 +295,7 @@ core_open (filename, from_tty)
       /* FIXME: should be checking for errors from bfd_close (for one thing,
          on error it does not free all the storage associated with the
          bfd).  */
-      make_cleanup ((make_cleanup_func) bfd_close, temp_bfd);
+      make_cleanup_bfd_close (temp_bfd);
       error ("\"%s\" is not a core dump: %s",
             filename, bfd_errmsg (bfd_get_error ()));
     }
@@ -493,7 +493,7 @@ core_file_to_sym_file (core)
       /* FIXME: should be checking for errors from bfd_close (for one thing,
          on error it does not free all the storage associated with the
          bfd).  */
-      make_cleanup ((make_cleanup_func) bfd_close, temp_bfd);
+      make_cleanup_bfd_close (temp_bfd);
       error ("\"%s\" is not a core dump: %s",
             core, bfd_errmsg (bfd_get_error ()));
     }
index aa8987dda5688f88cb8e4300eb9a30b07c0268f9..390da352e089c02749ded28c51c11dfdfcfef5d8 100644 (file)
@@ -332,6 +332,8 @@ extern struct cleanup *make_cleanup_freeargv (char **);
 struct ui_file;
 extern struct cleanup *make_cleanup_ui_file_delete (struct ui_file *);
 
+extern struct cleanup *make_cleanup_bfd_close (bfd *abfd);
+
 extern struct cleanup *make_final_cleanup (make_cleanup_ftype *, void *);
 
 extern struct cleanup *make_my_cleanup (struct cleanup **,
index c5ced876caf880c9da3e7c34579452f13307a3c4..608f116c502e9d8ddf07992fd44164b3ef6123ed 100644 (file)
@@ -1580,7 +1580,7 @@ e7000_load (args, from_tty)
       perror_with_name (filename);
       return;
     }
-  old_chain = make_cleanup ((make_cleanup_func) bfd_close, pbfd);
+  old_chain = make_cleanup_bfd_close (pbfd);
 
   if (!bfd_check_format (pbfd, bfd_object))
     error ("\"%s\" is not an object file: %s", filename,
index 12590f88111097fbcf6f796df9ba3ce6af56f113..9a377a071a34f5a0ad383a463cbce518ae42c2b8 100644 (file)
@@ -1162,7 +1162,7 @@ download (load_arg_string, from_tty)
   /* FIXME: should be checking for errors from bfd_close (for one thing,
      on error it does not free all the storage associated with the
      bfd).  */
-  make_cleanup ((make_cleanup_func) bfd_close, pbfd);
+  make_cleanup_bfd_close (pbfd);
 
   QUIT;
   immediate_quit++;
index b6ea064cf9704ff5a85c11f0a0d3953b868392f6..91499af03f6daeae904eddf1f5c8a8ead544ad7c 100644 (file)
@@ -614,7 +614,7 @@ download (target_name, args, from_tty, write_routine, start_routine)
       perror_with_name (filename);
       return;
     }
-  old_chain = make_cleanup ((make_cleanup_func) bfd_close, pbfd);
+  old_chain = make_cleanup_bfd_close (pbfd);
 
   if (!bfd_check_format (pbfd, bfd_object))
     error ("\"%s\" is not an object file: %s", filename,
index b01fe33f7121ad2460601b87490f120a425cbcb9..8fc4fe7c962f7e2ceb2ea3d7da706b8c9a33288e 100644 (file)
@@ -1230,7 +1230,7 @@ generic_load (char *args, int from_tty)
   /* FIXME: should be checking for errors from bfd_close (for one thing,
      on error it does not free all the storage associated with the
      bfd).  */
-  make_cleanup ((make_cleanup_func) bfd_close, loadfile_bfd);
+  make_cleanup_bfd_close (loadfile_bfd);
 
   if (!bfd_check_format (loadfile_bfd, bfd_object))
     {
index aa1fccd2853bd9040a7605742c0bf2c546318ed6..3fd055caad92a33a8e96b326b5aaf5fc1cc03c93 100644 (file)
@@ -203,6 +203,18 @@ make_cleanup_freeargv (arg)
   return make_my_cleanup (&cleanup_chain, do_freeargv, arg);
 }
 
+static void
+do_bfd_close_cleanup (void *arg)
+{
+  bfd_close (arg);
+}
+
+struct cleanup *
+make_cleanup_bfd_close (bfd *abfd)
+{
+  return make_cleanup (do_bfd_close_cleanup, abfd);
+}
+
 static void
 do_ui_file_delete (void *arg)
 {