(trunk libT) remove unused functions: tr_bitsetDifference() tr_bitfieldDifference()

This commit is contained in:
Jordan Lee 2011-02-21 15:36:07 +00:00
parent 541effd743
commit 32237dbdb0
5 changed files with 2 additions and 51 deletions

View File

@ -173,19 +173,6 @@ tr_bitfieldOr( tr_bitfield * a, const tr_bitfield * b )
return a;
}
/* set 'a' to all the flags that were in 'a' but not 'b' */
void
tr_bitfieldDifference( tr_bitfield * a, const tr_bitfield * b )
{
uint8_t * ait = a->bits;
const uint8_t * aend = ait + a->byteCount;
const uint8_t * bit = b->bits;
const uint8_t * bend = bit + b->byteCount;
while( ait!=aend && bit!=bend )
*ait++ &= ~( *bit++ );
}
size_t
tr_bitfieldCountTrueBits( const tr_bitfield* b )
{

View File

@ -55,8 +55,6 @@ int tr_bitfieldAddRange( tr_bitfield *, size_t begin, size_t end );
int tr_bitfieldRemRange( tr_bitfield*, size_t begin, size_t end );
void tr_bitfieldDifference( tr_bitfield *, const tr_bitfield * );
int tr_bitfieldIsEmpty( const tr_bitfield* );
size_t tr_bitfieldCountTrueBits( const tr_bitfield* );

View File

@ -60,16 +60,6 @@ tr_bitsetOr( tr_bitfield * a, const tr_bitset * b )
tr_bitfieldOr( a, &b->bitfield );
}
/* set 'a' to all the flags that were in 'a' but not 'b' */
void
tr_bitsetDifference( tr_bitfield * a, const tr_bitset * b )
{
if( b->haveAll )
tr_bitfieldClear( a );
else if( !b->haveNone )
tr_bitfieldDifference( a, &b->bitfield );
}
double
tr_bitsetPercent( const tr_bitset * b )
{

View File

@ -48,7 +48,4 @@ tr_bool tr_bitsetHas( const tr_bitset * b, const size_t nth );
void tr_bitsetOr( tr_bitfield * a, const tr_bitset * b );
/* set 'a' to all the flags that were in 'a' but not 'b' */
void tr_bitsetDifference( tr_bitfield * a, const tr_bitset * b );
#endif

View File

@ -3105,29 +3105,8 @@ shouldPeerBeClosed( const Torrent * t,
/* if we're seeding and the peer has everything we have,
* and enough time has passed for a pex exchange, then disconnect */
if( tr_torrentIsSeed( tor ) )
{
tr_bool peerHasEverything;
if( atom->seedProbability != -1 )
{
peerHasEverything = atomIsSeed( atom );
}
else
{
tr_bitfield * tmp = tr_bitfieldDup( tr_cpPieceBitfield( &tor->completion ) );
tr_bitsetDifference( tmp, &peer->have );
peerHasEverything = tr_bitfieldCountTrueBits( tmp ) == 0;
tr_bitfieldFree( tmp );
}
if( peerHasEverything && ( !tr_torrentAllowsPex(tor) || (now-atom->time>=30 )))
{
tordbg( t, "purging peer %s because we're both seeds",
tr_atomAddrStr( atom ) );
return TRUE;
}
}
if( tr_torrentIsSeed( tor ) && ( peer->progress >= 1.0f ) )
return !tr_torrentAllowsPex(tor) || (now-atom->time>=30);
/* disconnect if it's been too long since piece data has been transferred.
* this is on a sliding scale based on number of available peers... */