aboutsummaryrefslogtreecommitdiff
path: root/butl/fdstream.ixx
diff options
context:
space:
mode:
Diffstat (limited to 'butl/fdstream.ixx')
-rw-r--r--butl/fdstream.ixx26
1 files changed, 12 insertions, 14 deletions
diff --git a/butl/fdstream.ixx b/butl/fdstream.ixx
index 5d38d36..e511718 100644
--- a/butl/fdstream.ixx
+++ b/butl/fdstream.ixx
@@ -8,6 +8,15 @@ namespace butl
{
// auto_fd
//
+ inline void auto_fd::
+ reset (int fd) noexcept
+ {
+ if (fd_ >= 0)
+ fdclose (fd_); // Don't check for an error as not much we can do here.
+
+ fd_ = fd;
+ }
+
inline auto_fd& auto_fd::
operator= (auto_fd&& fd) noexcept
{
@@ -15,21 +24,10 @@ namespace butl
return *this;
}
- inline int auto_fd::
- release () noexcept
+ inline auto_fd::
+ ~auto_fd () noexcept
{
- int r (fd_);
- fd_ = -1;
- return r;
- }
-
- inline void auto_fd::
- reset (int fd) noexcept
- {
- if (fd_ >= 0)
- fdclose (fd_); // Don't check for an error as not much we can do here.
-
- fd_ = fd;
+ reset ();
}
// ifdstream