From 6f05024dabe7e70987496acaf90a1ebd55cbd609 Mon Sep 17 00:00:00 2001 From: Jordan Lee Date: Wed, 21 Sep 2011 20:17:36 +0000 Subject: [PATCH] #4496 'freeze when having a huge torrent' -- remove redundant debug calls to countArray(). This is a second iteration of optimizations based on MechMK1's Shark report. --- libtransmission/bitfield.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/libtransmission/bitfield.c b/libtransmission/bitfield.c index ba6f44e1d..b5a5bca10 100644 --- a/libtransmission/bitfield.c +++ b/libtransmission/bitfield.c @@ -185,8 +185,6 @@ tr_bitfieldEnsureBitsAlloced( tr_bitfield * b, size_t nth ) size_t bytes_needed; const bool has_all = tr_bitfieldHasAll( b ); - assert( tr_bitfieldIsValid( b ) ); - if( has_all ) bytes_needed = get_bytes_needed( MAX( nth, b->true_count ) + 1 ); else @@ -194,13 +192,9 @@ tr_bitfieldEnsureBitsAlloced( tr_bitfield * b, size_t nth ) if( b->alloc_count < bytes_needed ) { -#ifndef NDEBUG - const size_t old_count = countArray( b ); -#endif b->bits = tr_renew( uint8_t, b->bits, bytes_needed ); memset( b->bits + b->alloc_count, 0, bytes_needed - b->alloc_count ); b->alloc_count = bytes_needed; - assert( old_count == countArray( b ) ); if( has_all ) set_all_true( b->bits, b->true_count );