Add make_cleanup_close() function.

This commit is contained in:
Andrew Cagney 2000-05-23 14:48:13 +00:00
parent ba09750c1e
commit f5ff8c83c8
3 changed files with 20 additions and 0 deletions

View file

@ -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.

View 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_close (int fd);
extern struct cleanup *make_cleanup_bfd_close (bfd *abfd);
extern struct cleanup *make_final_cleanup (make_cleanup_ftype *, void *);

View file

@ -215,6 +215,19 @@ make_cleanup_bfd_close (bfd *abfd)
return make_cleanup (do_bfd_close_cleanup, 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)
{