diff options
| author | Joel Klinghed <the_jk@spawned.biz> | 2025-09-15 21:15:53 +0200 |
|---|---|---|
| committer | Joel Klinghed <the_jk@spawned.biz> | 2025-09-15 21:15:53 +0200 |
| commit | aa49abdf239bae6065fddd0839ec67a404c9748c (patch) | |
| tree | 631fbb2df58aa35df3d60c65c037ef74b1807114 /src/unique_fd.hh | |
| parent | bf41a601fd0447bcf3a2937a595a1cd8ca5c1633 (diff) | |
Add .clang-format
Make it easier to keep a consistent style
Diffstat (limited to 'src/unique_fd.hh')
| -rw-r--r-- | src/unique_fd.hh | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/src/unique_fd.hh b/src/unique_fd.hh index 189d513..2950905 100644 --- a/src/unique_fd.hh +++ b/src/unique_fd.hh @@ -3,28 +3,19 @@ class unique_fd { public: - constexpr unique_fd() - : fd_(-1) {} - explicit constexpr unique_fd(int fd) - : fd_(fd) {} + constexpr unique_fd() : fd_(-1) {} + explicit constexpr unique_fd(int fd) : fd_(fd) {} unique_fd(unique_fd& fd) = delete; unique_fd& operator=(unique_fd& fd) = delete; - unique_fd(unique_fd&& fd) - : fd_(fd.release()) {} + unique_fd(unique_fd&& fd) : fd_(fd.release()) {} unique_fd& operator=(unique_fd&& fd) { reset(fd.release()); return *this; } - ~unique_fd() { - reset(); - } + ~unique_fd() { reset(); } - bool operator==(unique_fd const& fd) const { - return get() == fd.get(); - } - bool operator!=(unique_fd const& fd) const { - return get() != fd.get(); - } + bool operator==(unique_fd const& fd) const { return get() == fd.get(); } + bool operator!=(unique_fd const& fd) const { return get() != fd.get(); } int get() const { return fd_; } explicit operator bool() const { return fd_ != -1; } |
