aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/defs.h2
-rw-r--r--gdb/utils.c13
3 files changed, 20 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index d18c753..3fd02bd 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+Wed May 24 00:38:09 2000 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * utils.c (make_cleanup_close, do_close_cleanup): New functions.
+ * defs.h (make_cleanup_close): Add declaration.
+
Tue May 23 20:47:50 2000 Andrew Cagney <cagney@b1.cygnus.com>
* configure.in (build_warnings): Add -Wuninitialized.
diff --git a/gdb/defs.h b/gdb/defs.h
index d2810dc..b11edd1 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -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_close (int fd);
+
extern struct cleanup *make_cleanup_bfd_close (bfd *abfd);
extern struct cleanup *make_final_cleanup (make_cleanup_ftype *, void *);
diff --git a/gdb/utils.c b/gdb/utils.c
index 8e2c5c5..6f5264a 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -216,6 +216,19 @@ make_cleanup_bfd_close (bfd *abfd)
}
static void
+do_close_cleanup (void *arg)
+{
+ close ((int) arg);
+}
+
+struct cleanup *
+make_cleanup_close (int fd)
+{
+ /* int into void*. Outch!! */
+ return make_cleanup (do_close_cleanup, (void *) fd);
+}
+
+static void
do_ui_file_delete (void *arg)
{
ui_file_delete (arg);