fix some unintentional copies (with explicit moves)

This commit is contained in:
arvidn 2018-06-30 18:43:17 +02:00 committed by Arvid Norberg
parent d439c8729a
commit 10deff2f91
9 changed files with 14 additions and 14 deletions

View File

@ -2173,7 +2173,7 @@ namespace {
peers.push_back(detail::read_v6_endpoint<tcp::endpoint>(v6_ptr));
#endif
return peers;
return std::move(peers);
}
dht_direct_response_alert::dht_direct_response_alert(
@ -2409,7 +2409,7 @@ namespace {
TORRENT_UNUSED(v6_nodes_idx);
#endif
return nodes;
return std::move(nodes);
}
}
@ -2507,7 +2507,7 @@ namespace {
const char *ptr = m_alloc.get().ptr(m_samples_idx);
std::memcpy(samples.data(), ptr, samples.size() * 20);
return samples;
return std::move(samples);
}
int dht_sample_infohashes_alert::num_nodes() const

View File

@ -127,7 +127,7 @@ observer_ptr find_data::new_observer(udp::endpoint const& ep
#if TORRENT_USE_ASSERTS
if (o) o->m_in_constructor = false;
#endif
return o;
return std::move(o);
}
char const* find_data::name() const { return "find_data"; }

View File

@ -127,7 +127,7 @@ observer_ptr get_item::new_observer(udp::endpoint const& ep
#if TORRENT_USE_ASSERTS
if (o) o->m_in_constructor = false;
#endif
return o;
return std::move(o);
}
bool get_item::invoke(observer_ptr o)

View File

@ -157,7 +157,7 @@ observer_ptr get_peers::new_observer(udp::endpoint const& ep
#if TORRENT_USE_ASSERTS
if (o) o->m_in_constructor = false;
#endif
return o;
return std::move(o);
}
obfuscated_get_peers::obfuscated_get_peers(
@ -184,7 +184,7 @@ observer_ptr obfuscated_get_peers::new_observer(udp::endpoint const& ep
#if TORRENT_USE_ASSERTS
if (o) o->m_in_constructor = false;
#endif
return o;
return std::move(o);
}
else
{
@ -193,7 +193,7 @@ observer_ptr obfuscated_get_peers::new_observer(udp::endpoint const& ep
#if TORRENT_USE_ASSERTS
if (o) o->m_in_constructor = false;
#endif
return o;
return std::move(o);
}
}

View File

@ -44,7 +44,7 @@ observer_ptr bootstrap::new_observer(udp::endpoint const& ep
#if TORRENT_USE_ASSERTS
if (o) o->m_in_constructor = false;
#endif
return o;
return std::move(o);
}
bool bootstrap::invoke(observer_ptr o)

View File

@ -77,7 +77,7 @@ observer_ptr traversal_algorithm::new_observer(udp::endpoint const& ep
#if TORRENT_USE_ASSERTS
if (o) o->m_in_constructor = false;
#endif
return o;
return std::move(o);
}
traversal_algorithm::traversal_algorithm(node& dht_node, node_id const& target)

View File

@ -568,7 +568,7 @@ namespace {
stats[i].type = metrics[i].value_index >= counters::num_stats_counters
? stats_metric::type_gauge : stats_metric::type_counter;
}
return stats;
return std::move(stats);
}
int find_metric_idx(string_view name)

View File

@ -474,7 +474,7 @@ namespace libtorrent {
aux::vector<download_priority_t, piece_index_t> ret;
auto retp = &ret;
sync_call(&torrent::piece_priorities, retp);
return ret;
return std::move(ret);
}
#if TORRENT_ABI_VERSION == 1
@ -529,7 +529,7 @@ namespace libtorrent {
aux::vector<download_priority_t, file_index_t> ret;
auto retp = &ret;
sync_call(&torrent::file_priorities, retp);
return ret;
return std::move(ret);
}
#if TORRENT_ABI_VERSION == 1

View File

@ -636,7 +636,7 @@ namespace libtorrent {namespace {
bt_peer_connection* c = static_cast<bt_peer_connection*>(pc.native_handle().get());
auto p = std::make_shared<ut_pex_peer_plugin>(m_torrent, *c, *this);
c->set_ut_pex(p);
return p;
return std::move(p);
}
} }