]> granicus.if.org Git - transmission/commitdiff
(trunk libT) disable the comparePieceByWeight assertions in trunk too.
authorCharles Kerr <charles@transmissionbt.com>
Sun, 7 Mar 2010 22:56:14 +0000 (22:56 +0000)
committerCharles Kerr <charles@transmissionbt.com>
Sun, 7 Mar 2010 22:56:14 +0000 (22:56 +0000)
libtransmission/peer-mgr.c

index d880c99c0b532c16d77c9a3f0e27a8ded5423bb3..7b7fc6e1d43b2235402a5b6aa8a0c9ed8fffb19c 100644 (file)
@@ -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; i<t->pieceCount-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; i<t->pieceCount-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 )
 {