From a8562a9f1991dbe4027265b2003dbbc5ebf04a76 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Wed, 30 Jul 2008 06:42:08 +0000 Subject: [PATCH] small optimization of expensive invariant check --- src/peer_connection.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/peer_connection.cpp b/src/peer_connection.cpp index 95dd990b5..481361b6a 100644 --- a/src/peer_connection.cpp +++ b/src/peer_connection.cpp @@ -3710,13 +3710,13 @@ namespace libtorrent #ifdef TORRENT_EXPENSIVE_INVARIANT_CHECKS if (m_peer_info) { - policy::const_iterator i; - for (i = t->get_policy().begin_peer() - , end(t->get_policy().end_peer()); i != end; ++i) + policy::const_iterator i = t->get_policy().begin_peer(); + policy::const_iterator end = t->get_policy().end_peer(); + for (; i != end; ++i) { if (&i->second == m_peer_info) break; } - TORRENT_ASSERT(i != t->get_policy().end_peer()); + TORRENT_ASSERT(i != end); } #endif if (t->has_picker() && !t->is_aborted())