disable invariant_check functions when invariant checks are disabled

This commit is contained in:
Arvid Norberg 2013-02-25 04:13:46 +00:00
parent 775cf5570a
commit a0caa0f4b2
28 changed files with 38 additions and 36 deletions

View File

@ -1007,7 +1007,7 @@ namespace libtorrent
// get to download again after the disk has been
// blocked
connection_map::iterator m_next_disk_peer;
#ifdef TORRENT_DEBUG
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
void check_invariant() const;
#endif

View File

@ -249,7 +249,7 @@ namespace libtorrent
void on_connected();
void on_metadata();
#ifdef TORRENT_DEBUG
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
void check_invariant() const;
ptime m_last_choke;
#endif

View File

@ -84,7 +84,7 @@ public:
}
#endif
#ifdef TORRENT_DEBUG
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
void check_invariant() const;
#endif

View File

@ -259,7 +259,7 @@ namespace libtorrent
void thread_fun();
#ifdef TORRENT_DEBUG
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
void check_invariant() const;
#endif

View File

@ -94,7 +94,7 @@ namespace libtorrent
index_type span() const
{ return (m_last - m_first) & 0xffff; }
#ifdef TORRENT_DEBUG
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
void check_invariant() const;
#endif

View File

@ -533,8 +533,10 @@ namespace libtorrent
void assign_bandwidth(int channel, int amount);
#ifdef TORRENT_DEBUG
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
void check_invariant() const;
#endif
#if defined TORRENT_DEBUG
ptime m_last_choke;
#endif

View File

@ -362,10 +362,12 @@ namespace libtorrent
#ifdef TORRENT_DEBUG
// used in debug mode
void verify_priority(int start, int end, int prio) const;
void check_invariant(const torrent* t = 0) const;
void verify_pick(std::vector<piece_block> const& picked
, bitfield const& bits) const;
#endif
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
void check_invariant(const torrent* t = 0) const;
#endif
#if defined TORRENT_PICKER_LOG
void print_pieces() const;
#endif

View File

@ -150,7 +150,7 @@ namespace libtorrent
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
bool has_connection(const peer_connection* p);
#endif
#ifdef TORRENT_DEBUG
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
void check_invariant() const;
#endif

View File

@ -460,11 +460,11 @@ namespace libtorrent
int move_storage_impl(std::string const& save_path);
int allocate_slot_for_piece(int piece_index);
#ifdef TORRENT_DEBUG
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
void check_invariant() const;
#endif
#ifdef TORRENT_STORAGE_DEBUG
void debug_log() const;
#endif
#endif
boost::intrusive_ptr<torrent_info const> m_info;
file_storage const& m_files;

View File

@ -744,7 +744,7 @@ namespace libtorrent
#endif
// DEBUG
#ifdef TORRENT_DEBUG
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
void check_invariant() const;
#endif

View File

@ -424,7 +424,7 @@ namespace libtorrent
: m_torrent(t)
{}
#ifdef TORRENT_DEBUG
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
void check_invariant() const;
#endif

View File

@ -129,7 +129,7 @@ namespace libtorrent
void write_allow_fast(int) {}
void write_suggest(int piece) {}
#ifdef TORRENT_DEBUG
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
void check_invariant() const;
#endif

View File

@ -120,7 +120,7 @@ namespace libtorrent
return 0;
}
#ifdef TORRENT_DEBUG
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
void bandwidth_manager::check_invariant() const
{
int queued = 0;

View File

@ -3337,7 +3337,7 @@ namespace libtorrent
}
}
#ifdef TORRENT_DEBUG
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
void bt_peer_connection::check_invariant() const
{
boost::shared_ptr<torrent> t = associated_torrent().lock();

View File

@ -169,8 +169,7 @@ namespace libtorrent
int connection_queue::limit() const
{ return m_half_open_limit; }
#ifdef TORRENT_DEBUG
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
void connection_queue::check_invariant() const
{
int num_connecting = 0;

View File

@ -916,7 +916,7 @@ namespace libtorrent
return ret;
}
#ifdef TORRENT_DEBUG
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
void disk_io_thread::check_invariant() const
{
int cached_write_blocks = 0;

View File

@ -48,7 +48,7 @@ namespace libtorrent {
, m_last(0)
{}
#ifdef TORRENT_DEBUG
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
void packet_buffer::check_invariant() const
{
int count = 0;

View File

@ -5573,7 +5573,7 @@ namespace libtorrent
setup_send();
}
#ifdef TORRENT_DEBUG
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
struct peer_count_t
{
peer_count_t(): num_peers(0), num_peers_with_timeouts(0), num_peers_with_nowant(0), num_not_requested(0) {}

View File

@ -79,7 +79,7 @@ namespace libtorrent
#ifdef TORRENT_PICKER_LOG
std::cerr << "new piece_picker" << std::endl;
#endif
#ifdef TORRENT_DEBUG
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
check_invariant();
#endif
}
@ -273,8 +273,10 @@ namespace libtorrent
}
std::cerr << std::endl;
}
#endif
#endif // TORRENT_PIECE_PICKER
#endif // TORRENT_DEBUG
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
void piece_picker::check_invariant(const torrent* t) const
{
#ifndef TORRENT_DEBUG_REFCOUNTS

View File

@ -1713,7 +1713,7 @@ namespace libtorrent
}
#endif
#ifdef TORRENT_DEBUG
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
void policy::check_invariant() const
{
TORRENT_ASSERT(m_num_connect_candidates >= 0);

View File

@ -6229,7 +6229,7 @@ retry:
#endif
}
#ifdef TORRENT_DEBUG
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
void session_impl::check_invariant() const
{
TORRENT_ASSERT(is_network_thread());

View File

@ -2894,7 +2894,7 @@ ret:
return m_slot_to_piece[slot];
}
#ifdef TORRENT_DEBUG
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
void piece_manager::check_invariant() const
{
TORRENT_ASSERT(m_current_slot <= m_files.num_pieces());

View File

@ -6598,7 +6598,7 @@ namespace libtorrent
return m_ses.settings();
}
#ifdef TORRENT_DEBUG
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
void torrent::check_invariant() const
{
for (std::deque<time_critical_piece>::const_iterator i = m_time_critical_pieces.begin()

View File

@ -267,8 +267,7 @@ namespace libtorrent
}
#endif
#ifdef TORRENT_DEBUG
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
void torrent_handle::check_invariant() const
{}

View File

@ -1341,7 +1341,7 @@ namespace libtorrent
// ------- end deprecation -------
#endif
#ifdef TORRENT_DEBUG
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
void torrent_info::check_invariant() const
{
for (file_storage::iterator i = m_files.begin()

View File

@ -326,7 +326,7 @@ struct utp_socket_impl
void check_receive_buffers() const;
#ifdef TORRENT_DEBUG
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
void check_invariant() const;
#endif
@ -1479,8 +1479,6 @@ void utp_socket_impl::write_payload(boost::uint8_t* ptr, int size)
if (size == 0) return;
ptime now = time_now_hires();
int buffers_to_clear = 0;
while (size > 0)
{
@ -3309,7 +3307,7 @@ void utp_socket_impl::check_receive_buffers() const
TORRENT_ASSERT(int(size) == m_receive_buffer_size);
}
#ifdef TORRENT_DEBUG
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
void utp_socket_impl::check_invariant() const
{
for (int i = m_outbuf.cursor();

View File

@ -188,7 +188,7 @@ namespace libtorrent
}
#ifdef TORRENT_DEBUG
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
void web_connection_base::check_invariant() const
{
/*

View File

@ -157,7 +157,7 @@ boost::shared_ptr<piece_picker> setup_picker(
TEST_CHECK(avail == availability_vec[i]);
}
#ifdef TORRENT_DEBUG
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
p->check_invariant();
#endif
return p;
@ -166,7 +166,7 @@ boost::shared_ptr<piece_picker> setup_picker(
bool verify_pick(boost::shared_ptr<piece_picker> p
, std::vector<piece_block> const& picked, bool allow_multi_blocks = false)
{
#ifdef TORRENT_DEBUG
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
p->check_invariant();
#endif
if (!allow_multi_blocks)