moved some invariant checks into 'full-invariant-checks' builds

This commit is contained in:
Arvid Norberg 2008-10-10 05:25:55 +00:00
parent e109b64b27
commit 8499fd2fe2
2 changed files with 7 additions and 2 deletions

View File

@ -1616,7 +1616,7 @@ namespace libtorrent
#ifndef NDEBUG #ifndef NDEBUG
check_postcondition post_checker_(t); check_postcondition post_checker_(t);
#if !defined TORRENT_DISABLE_INVARIANT_CHECKS #if !defined TORRENT_DISABLE_INVARIANT_CHECKS && defined TORRENT_EXPENSIVE_INVARIANT_CHECKS
t->check_invariant(); t->check_invariant();
#endif #endif
#endif #endif
@ -1791,7 +1791,8 @@ namespace libtorrent
TORRENT_ASSERT(picker.num_peers(block_finished) == 0); TORRENT_ASSERT(picker.num_peers(block_finished) == 0);
#if !defined NDEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS #if !defined NDEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS \
&& defined TORRENT_EXPENSIVE_INVARIANT_CHECKS
t->check_invariant(); t->check_invariant();
#endif #endif
request_a_block(*t, *this); request_a_block(*t, *this);

View File

@ -122,7 +122,9 @@ namespace libtorrent
void piece_picker::piece_info(int index, piece_picker::downloading_piece& st) const void piece_picker::piece_info(int index, piece_picker::downloading_piece& st) const
{ {
#ifdef TORRENT_EXPENSIVE_INVARIANT_CHECKS
TORRENT_PIECE_PICKER_INVARIANT_CHECK; TORRENT_PIECE_PICKER_INVARIANT_CHECK;
#endif
TORRENT_ASSERT(index >= 0); TORRENT_ASSERT(index >= 0);
TORRENT_ASSERT(index < int(m_piece_map.size())); TORRENT_ASSERT(index < int(m_piece_map.size()));
@ -1312,7 +1314,9 @@ namespace libtorrent
// only one of rarest_first and sequential can be set. // only one of rarest_first and sequential can be set.
TORRENT_ASSERT(bool(options & rarest_first) TORRENT_ASSERT(bool(options & rarest_first)
+ bool(options & sequential) <= 1); + bool(options & sequential) <= 1);
#ifdef TORRENT_EXPENSIVE_INVARIANT_CHECKS
TORRENT_PIECE_PICKER_INVARIANT_CHECK; TORRENT_PIECE_PICKER_INVARIANT_CHECK;
#endif
TORRENT_ASSERT(num_blocks > 0); TORRENT_ASSERT(num_blocks > 0);
TORRENT_ASSERT(pieces.size() == m_piece_map.size()); TORRENT_ASSERT(pieces.size() == m_piece_map.size());