diff options
Diffstat (limited to 'include/llfio/v2.0/detail/impl/posix')
4 files changed, 16 insertions, 14 deletions
diff --git a/include/llfio/v2.0/detail/impl/posix/async_file_handle.ipp b/include/llfio/v2.0/detail/impl/posix/async_file_handle.ipp index 4a3a8652..58b55479 100644 --- a/include/llfio/v2.0/detail/impl/posix/async_file_handle.ipp +++ b/include/llfio/v2.0/detail/impl/posix/async_file_handle.ipp @@ -36,7 +36,7 @@ async_file_handle::io_result<async_file_handle::const_buffers_type> async_file_h { LLFIO_LOG_FUNCTION_CALL(this); optional<io_result<const_buffers_type>> ret; - OUTCOME_TRY(io_state, async_barrier(reqs, [&ret](async_file_handle *, io_result<const_buffers_type> &result) { ret = result; }, wait_for_device, and_metadata)); + OUTCOME_TRY(io_state, async_barrier(reqs, [&ret](async_file_handle *, io_result<const_buffers_type> &&result) { ret = std::move(result); }, wait_for_device, and_metadata)); (void) io_state; // While i/o is not done pump i/o completion @@ -46,7 +46,7 @@ async_file_handle::io_result<async_file_handle::const_buffers_type> async_file_h // If i/o service pump failed or timed out, cancel outstanding i/o and return if(!t) { - return t.error(); + return std::move(t).error(); } #ifndef NDEBUG if(!ret && t && !t.value()) @@ -56,7 +56,7 @@ async_file_handle::io_result<async_file_handle::const_buffers_type> async_file_h } #endif } - return *ret; + return std::move(*ret); } template <class BuffersType, class IORoutine> result<async_file_handle::io_state_ptr> async_file_handle::_begin_io(span<char> mem, async_file_handle::operation_t operation, async_file_handle::io_request<BuffersType> reqs, async_file_handle::_erased_completion_handler &&completion, IORoutine && /*unused*/) noexcept @@ -328,7 +328,7 @@ async_file_handle::io_result<async_file_handle::buffers_type> async_file_handle: { LLFIO_LOG_FUNCTION_CALL(this); optional<io_result<buffers_type>> ret; - OUTCOME_TRY(io_state, async_read(reqs, [&ret](async_file_handle *, io_result<buffers_type> &result) { ret = result; })); + OUTCOME_TRY(io_state, async_read(reqs, [&ret](async_file_handle *, io_result<buffers_type> &&result) { ret = std::move(result); })); (void) io_state; // While i/o is not done pump i/o completion @@ -338,7 +338,7 @@ async_file_handle::io_result<async_file_handle::buffers_type> async_file_handle: // If i/o service pump failed or timed out, cancel outstanding i/o and return if(!t) { - return t.error(); + return std::move(t).error(); } #ifndef NDEBUG if(!ret && t && !t.value()) @@ -348,14 +348,14 @@ async_file_handle::io_result<async_file_handle::buffers_type> async_file_handle: } #endif } - return *ret; + return std::move(*ret); } async_file_handle::io_result<async_file_handle::const_buffers_type> async_file_handle::write(async_file_handle::io_request<async_file_handle::const_buffers_type> reqs, deadline d) noexcept { LLFIO_LOG_FUNCTION_CALL(this); optional<io_result<const_buffers_type>> ret; - OUTCOME_TRY(io_state, async_write(reqs, [&ret](async_file_handle *, io_result<const_buffers_type> &result) { ret = result; })); + OUTCOME_TRY(io_state, async_write(reqs, [&ret](async_file_handle *, io_result<const_buffers_type> &&result) { ret = std::move(result); })); (void) io_state; // While i/o is not done pump i/o completion @@ -365,7 +365,7 @@ async_file_handle::io_result<async_file_handle::const_buffers_type> async_file_h // If i/o service pump failed or timed out, cancel outstanding i/o and return if(!t) { - return t.error(); + return std::move(t).error(); } #ifndef NDEBUG if(!ret && t && !t.value()) @@ -375,7 +375,7 @@ async_file_handle::io_result<async_file_handle::const_buffers_type> async_file_h } #endif } - return *ret; + return std::move(*ret); } LLFIO_V2_NAMESPACE_END diff --git a/include/llfio/v2.0/detail/impl/posix/directory_handle.ipp b/include/llfio/v2.0/detail/impl/posix/directory_handle.ipp index 69bf45cf..fb312c81 100644 --- a/include/llfio/v2.0/detail/impl/posix/directory_handle.ipp +++ b/include/llfio/v2.0/detail/impl/posix/directory_handle.ipp @@ -172,7 +172,7 @@ result<directory_handle> directory_handle::clone(mode mode_, caching caching_, d { if(fh.error() != errc::no_such_file_or_directory) { - return fh.error(); + return std::move(fh).error(); } } // Check timeout diff --git a/include/llfio/v2.0/detail/impl/posix/file_handle.ipp b/include/llfio/v2.0/detail/impl/posix/file_handle.ipp index 7e67f193..b77a4717 100644 --- a/include/llfio/v2.0/detail/impl/posix/file_handle.ipp +++ b/include/llfio/v2.0/detail/impl/posix/file_handle.ipp @@ -308,7 +308,7 @@ result<file_handle> file_handle::clone(mode mode_, caching caching_, deadline d) { if(fh.error() != errc::no_such_file_or_directory) { - return fh.error(); + return std::move(fh).error(); } } // Check timeout diff --git a/include/llfio/v2.0/detail/impl/posix/symlink_handle.ipp b/include/llfio/v2.0/detail/impl/posix/symlink_handle.ipp index fba2832e..2f870922 100644 --- a/include/llfio/v2.0/detail/impl/posix/symlink_handle.ipp +++ b/include/llfio/v2.0/detail/impl/posix/symlink_handle.ipp @@ -185,7 +185,7 @@ result<symlink_handle> symlink_handle::clone(mode mode_, deadline d) const noexc { if(fh.error() != errc::no_such_file_or_directory) { - return fh.error(); + return std::move(fh).error(); } } // Check timeout @@ -357,7 +357,9 @@ LLFIO_HEADERS_ONLY_MEMFUNC_SPEC result<symlink_handle> symlink_handle::symlink(c if(!r) { if(_creation == creation::only_if_not_exist || r.error() != errc::file_exists) - return r.error(); + { + return std::move(r).error(); + } } break; } @@ -456,7 +458,7 @@ result<symlink_handle::const_buffers_type> symlink_handle::write(symlink_handle: // If reopen failed, report that now if(!newthis) { - return newthis.error(); + return std::move(newthis).error(); } // Swap myself with the new this swap(newthis.value()); |