From: Charles Kerr Date: Sun, 7 Mar 2010 22:56:14 +0000 (+0000) Subject: (trunk libT) disable the comparePieceByWeight assertions in trunk too. X-Git-Tag: 2.00~368 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b1a29969fe9a6d6d842fa59e57fe5c48feddaae4;p=transmission (trunk libT) disable the comparePieceByWeight assertions in trunk too. --- diff --git a/libtransmission/peer-mgr.c b/libtransmission/peer-mgr.c index d880c99c0..7b7fc6e1d 100644 --- a/libtransmission/peer-mgr.c +++ b/libtransmission/peer-mgr.c @@ -728,24 +728,6 @@ comparePieceByWeight( const void * va, const void * vb ) return 0; } -/** - * This function is useful for sanity checking, - * but is too expensive even for nightly builds... - * let's leave it disabled but add an easy hook to compile it back in - */ -#if 1 -static void -assertWeightedPiecesAreSorted( Torrent * t ) -{ - int i; - weightTorrent = t->tor; - for( i=0; ipieceCount-1; ++i ) - assert( comparePieceByWeight( &t->pieces[i], &t->pieces[i+1] ) <= 0 ); -} -#else -#define assertWeightedPiecesAreSorted(t) -#endif - static int comparePieceByIndex( const void * va, const void * vb ) { @@ -792,6 +774,27 @@ isInEndgame( Torrent * t ) return endgame; } +/** + * This function is useful for sanity checking, + * but is too expensive even for nightly builds... + * let's leave it disabled but add an easy hook to compile it back in + */ +#if 0 +static void +assertWeightedPiecesAreSorted( Torrent * t ) +{ + if( !isInEndgame( t ) ) + { + int i; + weightTorrent = t->tor; + for( i=0; ipieceCount-1; ++i ) + assert( comparePieceByWeight( &t->pieces[i], &t->pieces[i+1] ) <= 0 ); + } +} +#else +#define assertWeightedPiecesAreSorted(t) +#endif + static struct weighted_piece * pieceListLookup( Torrent * t, tr_piece_index_t index ) {