diff options
author | Gary Benson <gbenson@redhat.com> | 2015-06-10 14:28:43 +0100 |
---|---|---|
committer | Gary Benson <gbenson@redhat.com> | 2015-06-10 14:28:43 +0100 |
commit | ca09583623ab77362186a9fd1ae260c38dcab470 (patch) | |
tree | 17f292e5f5d0ff93490f5b5ebbd2da663520d672 /gdb/utils.c | |
parent | 5d9c55d355c8e5c688caa3fe43c0d95d538daf35 (diff) | |
download | gdb-ca09583623ab77362186a9fd1ae260c38dcab470.zip gdb-ca09583623ab77362186a9fd1ae260c38dcab470.tar.gz gdb-ca09583623ab77362186a9fd1ae260c38dcab470.tar.bz2 |
Move make_cleanup_close to common code
This commit moves the function make_cleanup_close from gdb/utils.[ch]
to gdb/common/filestuff.[ch] to make it usable from common code.
gdb/ChangeLog:
* utils.h (make_cleanup_close): Moved to common/filestuff.h.
* utils.c (do_close_cleanup): Moved to common/filestuff.c.
(make_cleanup_close): Likewise.
* common/filestuff.h (make_cleanup_close): Moved from utils.h.
* common/filestuff.c (do_close_cleanup): Moved from utils.c.
(make_cleanup_close): Likewise.
Diffstat (limited to 'gdb/utils.c')
-rw-r--r-- | gdb/utils.c | 17 |
1 files changed, 0 insertions, 17 deletions
diff --git a/gdb/utils.c b/gdb/utils.c index aaaf9c5..1c1ced4 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -191,23 +191,6 @@ make_cleanup_bfd_unref (bfd *abfd) return make_cleanup (do_bfd_close_cleanup, abfd); } -static void -do_close_cleanup (void *arg) -{ - int *fd = arg; - - close (*fd); -} - -struct cleanup * -make_cleanup_close (int fd) -{ - int *saved_fd = xmalloc (sizeof (fd)); - - *saved_fd = fd; - return make_cleanup_dtor (do_close_cleanup, saved_fd, xfree); -} - /* Helper function which does the work for make_cleanup_fclose. */ static void |