(libT) remove some dead functions: tr_calloc(), tr_compareUint16(), tr_compareUint32()

This commit is contained in:
Charles Kerr 2008-08-21 19:03:56 +00:00
parent 2d2d173275
commit 1105dc0038
4 changed files with 11 additions and 28 deletions

View File

@ -184,7 +184,7 @@ torrentIsLocked( const Torrent * t )
static int
compareAddresses( const struct in_addr * a, const struct in_addr * b )
{
return tr_compareUint32( a->s_addr, b->s_addr );
return a->s_addr - b->s_addr;
}
static int
@ -1767,7 +1767,7 @@ compareCandidates( const void * va, const void * vb )
if( a->piece_data_time > b->piece_data_time ) return -1;
if( a->piece_data_time < b->piece_data_time ) return 1;
if(( i = tr_compareUint16( a->numFails, b->numFails )))
if(( i = a->numFails - b->numFails ))
return i;
if( a->time != b->time )

View File

@ -117,6 +117,14 @@ struct peer_request
time_t time_requested;
};
static int
tr_compareUint32( uint32_t a, uint32_t b )
{
if( a < b ) return -1;
if( a > b ) return 1;
return 0;
}
static int
compareRequest( const void * va, const void * vb )
{

View File

@ -324,22 +324,6 @@ tr_set_compare( const void * va, size_t aCount,
****
***/
int
tr_compareUint16( uint16_t a, uint16_t b )
{
if( a < b ) return -1;
if( a > b ) return 1;
return 0;
}
int
tr_compareUint32( uint32_t a, uint32_t b )
{
if( a < b ) return -1;
if( a > b ) return 1;
return 0;
}
int
tr_compareUint64( uint64_t a, uint64_t b )
{
@ -671,12 +655,6 @@ tr_strdup_printf( const char * fmt, ... )
return ret;
}
void*
tr_calloc( size_t nmemb, size_t size )
{
return nmemb && size ? calloc( nmemb, size ) : NULL;
}
void*
tr_malloc( size_t size )
{
@ -724,7 +702,7 @@ tr_bitfieldNew( size_t bitCount )
tr_bitfield*
tr_bitfieldDup( const tr_bitfield * in )
{
tr_bitfield * ret = calloc( 1, sizeof(tr_bitfield) );
tr_bitfield * ret = tr_new0( tr_bitfield, 1 );
ret->bitCount = in->bitCount;
ret->byteCount = in->byteCount;
ret->bits = tr_memdup( in->bits, in->byteCount );

View File

@ -183,7 +183,6 @@ void tr_wait( uint64_t delay_milliseconds );
void* tr_malloc ( size_t ) TR_GNUC_MALLOC;
void* tr_malloc0 ( size_t ) TR_GNUC_MALLOC;
void* tr_calloc ( size_t nmemb, size_t size ) TR_GNUC_MALLOC;
void tr_free ( void* );
char* tr_strdup( const void * str ) TR_GNUC_MALLOC;
@ -213,8 +212,6 @@ void tr_set_compare( const void * a, size_t aCount,
tr_set_func in_both_cb,
void * userData );
int tr_compareUint16( uint16_t a, uint16_t b );
int tr_compareUint32( uint32_t a, uint32_t b );
int tr_compareUint64( uint64_t a, uint64_t b );
int tr_compareDouble( double a, double b );
int tr_compareTime( time_t a, time_t b );