• R/O
  • SSH

posixpp: Commit

The main posixpp library and associated tests.


Commit MetaInfo

Revisionb1efa70ccb74a7bdc55c04be3801545e1bb7c91c (tree)
Time2021-05-11 01:02:35
AuthorEric Hopper <hopper@omni...>
CommiterEric Hopper

Log Message

Move close to near top of member functions because it's important.

Change Summary

Incremental Difference

diff -r 2c7097052749 -r b1efa70ccb74 pubincludes/posixpp/fd.h
--- a/pubincludes/posixpp/fd.h Mon May 10 08:59:13 2021 -0700
+++ b/pubincludes/posixpp/fd.h Mon May 10 09:02:35 2021 -0700
@@ -43,6 +43,15 @@
4343 return *this;
4444 }
4545
46+ //! \brief Sets fd to invalid value and also calls close regardless of
47+ //! whether fd is currently an invalid value.
48+ [[nodiscard]] expected<void> close() noexcept {
49+ using ::syscalls::linux::close;
50+ auto const tmpfd = fd_;
51+ fd_ = -1;
52+ return close(tmpfd);
53+ }
54+
4655 //! A true return value is maybe, a false return is definite.
4756 [[nodiscard]] constexpr bool is_valid() const noexcept {
4857 return fd_ >= 0;
@@ -114,15 +123,6 @@
114123 }
115124 //! @}
116125
117- //! \brief Sets fd to invalid value and also calls close regardless of
118- //! whether fd is currently an invalid value.
119- [[nodiscard]] expected<void> close() noexcept {
120- using ::syscalls::linux::close;
121- auto const tmpfd = fd_;
122- fd_ = -1;
123- return close(tmpfd);
124- }
125-
126126 protected:
127127 static fd int_to_fd(int fdes) noexcept {
128128 return fd{fdes};
Show on old repository browser