mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Cleanup code using move semantics
This commit is contained in:
@@ -148,10 +148,7 @@ insertDeliveredAmount(
|
||||
auto const getCloseTime = [&info] { return info.closeTime; };
|
||||
|
||||
auto amt = getDeliveredAmount(
|
||||
getLedgerIndex,
|
||||
getCloseTime,
|
||||
std::move(serializedTx),
|
||||
transactionMeta);
|
||||
getLedgerIndex, getCloseTime, serializedTx, transactionMeta);
|
||||
if (amt)
|
||||
{
|
||||
meta[jss::delivered_amount] =
|
||||
@@ -182,10 +179,7 @@ getDeliveredAmount(
|
||||
return context.ledgerMaster.getCloseTimeBySeq(getLedgerIndex());
|
||||
};
|
||||
return getDeliveredAmount(
|
||||
getLedgerIndex,
|
||||
getCloseTime,
|
||||
std::move(serializedTx),
|
||||
transactionMeta);
|
||||
getLedgerIndex, getCloseTime, serializedTx, transactionMeta);
|
||||
}
|
||||
|
||||
return {};
|
||||
|
||||
@@ -424,40 +424,43 @@ ShardArchiveHandler::complete(path dstPath)
|
||||
}
|
||||
}
|
||||
|
||||
auto wrapper = jobCounter_.wrap([=, dstPath = std::move(dstPath)](Job&) {
|
||||
if (isStopping())
|
||||
return;
|
||||
// Make lambdas mutable captured vars can be moved from
|
||||
auto wrapper =
|
||||
jobCounter_.wrap([=, dstPath = std::move(dstPath)](Job&) mutable {
|
||||
if (isStopping())
|
||||
return;
|
||||
|
||||
// If not synced then defer and retry
|
||||
auto const mode{app_.getOPs().getOperatingMode()};
|
||||
if (mode != OperatingMode::FULL)
|
||||
{
|
||||
std::lock_guard lock(m_);
|
||||
timer_.expires_from_now(static_cast<std::chrono::seconds>(
|
||||
(static_cast<std::size_t>(OperatingMode::FULL) -
|
||||
static_cast<std::size_t>(mode)) *
|
||||
10));
|
||||
// If not synced then defer and retry
|
||||
auto const mode{app_.getOPs().getOperatingMode()};
|
||||
if (mode != OperatingMode::FULL)
|
||||
{
|
||||
std::lock_guard lock(m_);
|
||||
timer_.expires_from_now(static_cast<std::chrono::seconds>(
|
||||
(static_cast<std::size_t>(OperatingMode::FULL) -
|
||||
static_cast<std::size_t>(mode)) *
|
||||
10));
|
||||
|
||||
auto wrapper =
|
||||
timerCounter_.wrap([=, dstPath = std::move(dstPath)](
|
||||
boost::system::error_code const& ec) {
|
||||
if (ec != boost::asio::error::operation_aborted)
|
||||
complete(std::move(dstPath));
|
||||
});
|
||||
auto wrapper = timerCounter_.wrap(
|
||||
[=, dstPath = std::move(dstPath)](
|
||||
boost::system::error_code const& ec) mutable {
|
||||
if (ec != boost::asio::error::operation_aborted)
|
||||
complete(std::move(dstPath));
|
||||
});
|
||||
|
||||
if (!wrapper)
|
||||
onClosureFailed(
|
||||
"failed to wrap closure for operating mode timer", lock);
|
||||
if (!wrapper)
|
||||
onClosureFailed(
|
||||
"failed to wrap closure for operating mode timer",
|
||||
lock);
|
||||
else
|
||||
timer_.async_wait(*wrapper);
|
||||
}
|
||||
else
|
||||
timer_.async_wait(*wrapper);
|
||||
}
|
||||
else
|
||||
{
|
||||
process(dstPath);
|
||||
std::lock_guard lock(m_);
|
||||
removeAndProceed(lock);
|
||||
}
|
||||
});
|
||||
{
|
||||
process(dstPath);
|
||||
std::lock_guard lock(m_);
|
||||
removeAndProceed(lock);
|
||||
}
|
||||
});
|
||||
|
||||
if (!wrapper)
|
||||
{
|
||||
|
||||
@@ -335,11 +335,7 @@ struct transactionPreProcessResult
|
||||
|
||||
transactionPreProcessResult() = delete;
|
||||
transactionPreProcessResult(transactionPreProcessResult const&) = delete;
|
||||
transactionPreProcessResult(transactionPreProcessResult&& rhs)
|
||||
: first(std::move(rhs.first)) // VS2013 won't default this.
|
||||
, second(std::move(rhs.second))
|
||||
{
|
||||
}
|
||||
transactionPreProcessResult(transactionPreProcessResult&& rhs) = default;
|
||||
|
||||
transactionPreProcessResult&
|
||||
operator=(transactionPreProcessResult const&) = delete;
|
||||
|
||||
Reference in New Issue
Block a user