fix V821 Decreased performance. (#2675)

The 't' variable can be constructed in a lower level scope
This commit is contained in:
Pavel Pimenov 2018-01-08 04:37:21 +03:00 committed by Arvid Norberg
parent 3e29968a92
commit 97ceeab9e3
1 changed files with 5 additions and 0 deletions

View File

@ -414,13 +414,18 @@ namespace {
if (!m_supports_fast) return;
#if TORRENT_USE_ASSERTS
std::shared_ptr<torrent> t = associated_torrent().lock();
TORRENT_ASSERT(t);
TORRENT_ASSERT(t->valid_metadata());
#endif
#ifndef TORRENT_DISABLE_LOGGING
if (should_log(peer_log_alert::outgoing_message))
{
#if !TORRENT_USE_ASSERTS
std::shared_ptr<torrent> t = associated_torrent().lock();
#endif
peer_log(peer_log_alert::outgoing_message, "SUGGEST"
, "piece: %d num_peers: %d", static_cast<int>(piece)
, t->has_picker() ? t->picker().get_availability(piece) : -1);