Changeset 6616


Ignore:
Timestamp:
Aug 21, 2008, 7:03:56 PM (13 years ago)
Author:
charles
Message:

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

Location:
trunk/libtransmission
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/peer-mgr.c

    r6599 r6616  
    185185compareAddresses( const struct in_addr * a, const struct in_addr * b )
    186186{
    187     return tr_compareUint32( a->s_addr, b->s_addr );
     187    return a->s_addr - b->s_addr;
    188188}
    189189
     
    17681768    if( a->piece_data_time < b->piece_data_time ) return  1;
    17691769
    1770     if(( i = tr_compareUint16( a->numFails, b->numFails )))
     1770    if(( i = a->numFails - b->numFails ))
    17711771        return i;
    17721772
  • trunk/libtransmission/peer-msgs.c

    r6612 r6616  
    117117    time_t time_requested;
    118118};
     119
     120static int
     121tr_compareUint32( uint32_t a, uint32_t b )
     122{
     123    if( a < b ) return -1;
     124    if( a > b ) return 1;
     125    return 0;
     126}
    119127
    120128static int
  • trunk/libtransmission/utils.c

    r6613 r6616  
    326326
    327327int
    328 tr_compareUint16( uint16_t a, uint16_t b )
    329 {
    330     if( a < b ) return -1;
    331     if( a > b ) return 1;
    332     return 0;
    333 }
    334 
    335 int
    336 tr_compareUint32( uint32_t a, uint32_t b )
    337 {
    338     if( a < b ) return -1;
    339     if( a > b ) return 1;
    340     return 0;
    341 }
    342 
    343 int
    344328tr_compareUint64( uint64_t a, uint64_t b )
    345329{
     
    673657
    674658void*
    675 tr_calloc( size_t nmemb, size_t size )
    676 {
    677     return nmemb && size ? calloc( nmemb, size ) : NULL;
    678 }
    679 
    680 void*
    681659tr_malloc( size_t size )
    682660{
     
    725703tr_bitfieldDup( const tr_bitfield * in )
    726704{
    727     tr_bitfield * ret = calloc( 1, sizeof(tr_bitfield) );
     705    tr_bitfield * ret = tr_new0( tr_bitfield, 1 );
    728706    ret->bitCount = in->bitCount;
    729707    ret->byteCount = in->byteCount;
  • trunk/libtransmission/utils.h

    r6613 r6616  
    184184void* tr_malloc  ( size_t ) TR_GNUC_MALLOC;
    185185void* tr_malloc0 ( size_t ) TR_GNUC_MALLOC;
    186 void* tr_calloc  ( size_t nmemb, size_t size ) TR_GNUC_MALLOC;
    187186void  tr_free    ( void* );
    188187
     
    214213                     void * userData );
    215214                   
    216 int tr_compareUint16( uint16_t a, uint16_t b );
    217 int tr_compareUint32( uint32_t a, uint32_t b );
    218215int tr_compareUint64( uint64_t a, uint64_t b );
    219216int tr_compareDouble( double a, double b );
Note: See TracChangeset for help on using the changeset viewer.