Changeset 7606


Ignore:
Timestamp:
Jan 4, 2009, 2:49:30 AM (12 years ago)
Author:
charles
Message:

(trunk libT) minor improvement to testing to see if two requests are equal

File:
1 edited

Legend:

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

    r7588 r7606  
    123123};
    124124
    125 static int
    126 compareRequest( const void * va, const void * vb )
    127 {
    128     const struct peer_request * a = va;
    129     const struct peer_request * b = vb;
    130 
    131     if( a->index != b->index )
    132         return a->index < b->index ? -1 : 1;
    133 
    134     if( a->offset != b->offset )
    135         return a->offset < b->offset ? -1 : 1;
    136 
    137     if( a->length != b->length )
    138         return a->length < b->length ? -1 : 1;
    139 
    140     return 0;
     125static inline tr_bool
     126requestsMatch( const struct peer_request * a, const struct peer_request * b )
     127{
     128    return (a->index==b->index) && (a->offset==b->offset) && (a->length==b->length);
    141129}
    142130
     
    222210
    223211    for( i = 0; i < list->count; ++i )
    224         if( !compareRequest( key, list->requests + i ) )
     212        if( requestsMatch( key, list->requests + i ) )
    225213            return i;
    226214
Note: See TracChangeset for help on using the changeset viewer.