]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gdb/common/filestuff.h
Remove do_closedir_cleanup
[thirdparty/binutils-gdb.git] / gdb / common / filestuff.h
index 92a2a5f4c70c9c519bcf8fe09803f2fd28b2dfce..0e46eb5da0b1ffe2edbc349651372fb3a787ca2e 100644 (file)
@@ -19,6 +19,8 @@
 #ifndef FILESTUFF_H
 #define FILESTUFF_H
 
+#include <dirent.h>
+
 /* Note all the file descriptors which are open when this is called.
    These file descriptors will not be closed by close_most_fds.  */
 
@@ -84,4 +86,16 @@ extern int gdb_pipe_cloexec (int filedes[2]);
 
 extern struct cleanup *make_cleanup_close (int fd);
 
+struct gdb_dir_deleter
+{
+  void operator() (DIR *dir) const
+  {
+    closedir (dir);
+  }
+};
+
+/* A unique pointer to a DIR.  */
+
+typedef std::unique_ptr<DIR, gdb_dir_deleter> gdb_dir_up;
+
 #endif /* FILESTUFF_H */