Loading base/include/android-base/unique_fd.h +4 −3 Original line number Original line Diff line number Diff line Loading @@ -92,6 +92,8 @@ class unique_fd_impl final { explicit unique_fd_impl(int fd) { reset(fd); } explicit unique_fd_impl(int fd) { reset(fd); } ~unique_fd_impl() { reset(); } ~unique_fd_impl() { reset(); } unique_fd_impl(const unique_fd_impl&) = delete; void operator=(const unique_fd_impl&) = delete; unique_fd_impl(unique_fd_impl&& other) noexcept { reset(other.release()); } unique_fd_impl(unique_fd_impl&& other) noexcept { reset(other.release()); } unique_fd_impl& operator=(unique_fd_impl&& s) noexcept { unique_fd_impl& operator=(unique_fd_impl&& s) noexcept { int fd = s.fd_; int fd = s.fd_; Loading @@ -118,6 +120,8 @@ class unique_fd_impl final { // Catch bogus error checks (i.e.: "!fd" instead of "fd != -1"). // Catch bogus error checks (i.e.: "!fd" instead of "fd != -1"). bool operator!() const = delete; bool operator!() const = delete; bool ok() const { return get() != -1; } int release() __attribute__((warn_unused_result)) { int release() __attribute__((warn_unused_result)) { tag(fd_, this, nullptr); tag(fd_, this, nullptr); int ret = fd_; int ret = fd_; Loading Loading @@ -167,9 +171,6 @@ class unique_fd_impl final { static auto close(int fd, void*) -> decltype(T::Close(fd), void()) { static auto close(int fd, void*) -> decltype(T::Close(fd), void()) { T::Close(fd); T::Close(fd); } } unique_fd_impl(const unique_fd_impl&); void operator=(const unique_fd_impl&); }; }; using unique_fd = unique_fd_impl<DefaultCloser>; using unique_fd = unique_fd_impl<DefaultCloser>; Loading Loading
base/include/android-base/unique_fd.h +4 −3 Original line number Original line Diff line number Diff line Loading @@ -92,6 +92,8 @@ class unique_fd_impl final { explicit unique_fd_impl(int fd) { reset(fd); } explicit unique_fd_impl(int fd) { reset(fd); } ~unique_fd_impl() { reset(); } ~unique_fd_impl() { reset(); } unique_fd_impl(const unique_fd_impl&) = delete; void operator=(const unique_fd_impl&) = delete; unique_fd_impl(unique_fd_impl&& other) noexcept { reset(other.release()); } unique_fd_impl(unique_fd_impl&& other) noexcept { reset(other.release()); } unique_fd_impl& operator=(unique_fd_impl&& s) noexcept { unique_fd_impl& operator=(unique_fd_impl&& s) noexcept { int fd = s.fd_; int fd = s.fd_; Loading @@ -118,6 +120,8 @@ class unique_fd_impl final { // Catch bogus error checks (i.e.: "!fd" instead of "fd != -1"). // Catch bogus error checks (i.e.: "!fd" instead of "fd != -1"). bool operator!() const = delete; bool operator!() const = delete; bool ok() const { return get() != -1; } int release() __attribute__((warn_unused_result)) { int release() __attribute__((warn_unused_result)) { tag(fd_, this, nullptr); tag(fd_, this, nullptr); int ret = fd_; int ret = fd_; Loading Loading @@ -167,9 +171,6 @@ class unique_fd_impl final { static auto close(int fd, void*) -> decltype(T::Close(fd), void()) { static auto close(int fd, void*) -> decltype(T::Close(fd), void()) { T::Close(fd); T::Close(fd); } } unique_fd_impl(const unique_fd_impl&); void operator=(const unique_fd_impl&); }; }; using unique_fd = unique_fd_impl<DefaultCloser>; using unique_fd = unique_fd_impl<DefaultCloser>; Loading