Changeset 6839


Ignore:
Timestamp:
Oct 2, 2008, 8:55:05 PM (13 years ago)
Author:
charles
Message:

(libT) eliminating tr_errno, part 2: don't use it in reqListPop() or reqListRemove()

File:
1 edited

Legend:

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

    r6832 r6839  
    226226}
    227227
    228 static tr_errno
     228static int
    229229reqListPop( struct request_list * list,
    230230            struct peer_request * setme )
    231231{
    232     tr_errno err;
     232    int success;
    233233
    234234    if( !list->count )
    235         err = TR_ERROR;
    236     else
    237     {
     235        success = FALSE;
     236    else {
    238237        *setme = list->requests[0];
    239238        reqListRemoveOne( list, 0 );
    240         err = TR_OK;
    241     }
    242 
    243     return err;
     239        success = TRUE;
     240    }
     241
     242    return success;
    244243}
    245244
     
    270269}
    271270
    272 static tr_errno
     271static int
    273272reqListRemove( struct request_list *       list,
    274273               const struct peer_request * key )
    275274{
    276     tr_errno  err;
     275    int success;
    277276    const int i = reqListFind( list, key );
    278277
    279278    if( i < 0 )
    280         err = TR_ERROR;
    281     else
    282     {
    283         err = TR_OK;
     279        success = FALSE;
     280    else {
    284281        reqListRemoveOne( list, i );
    285     }
    286 
    287     return err;
     282        success = TRUE;
     283    }
     284
     285    return success;
    288286}
    289287
     
    890888        return;
    891889
    892     while( ( count < max ) && !reqListPop( &msgs->clientWillAskFor, &req ) )
     890    while( ( count < max ) && reqListPop( &msgs->clientWillAskFor, &req ) )
    893891    {
    894892        assert( requestIsValid( msgs, &req ) );
     
    16331631    **/
    16341632
    1635     if( reqListRemove( &msgs->clientAskedFor, req ) )
     1633    if( !reqListRemove( &msgs->clientAskedFor, req ) )
    16361634    {
    16371635        clientGotUnwantedBlock( msgs, req );
     
    17281726}
    17291727
    1730 static tr_errno
     1728static int
    17311729popNextRequest( tr_peermsgs *         msgs,
    17321730                struct peer_request * setme )
    17331731{
    1734     if( !reqListPop( &msgs->peerAskedForFast, setme ) )
    1735         return 0;
    1736     if( !reqListPop( &msgs->peerAskedFor, setme ) )
    1737         return 0;
    1738 
    1739     return TR_ERROR;
     1732    return reqListPop( &msgs->peerAskedForFast, setme )
     1733        || reqListPop( &msgs->peerAskedFor, setme );
    17401734}
    17411735
     
    18051799        }
    18061800        else if( !EVBUFFER_LENGTH( msgs->outBlock )
    1807                && !popNextRequest( msgs, &req )
     1801               && popNextRequest( msgs, &req )
    18081802               && requestIsValid( msgs, &req )
    18091803               && tr_cpPieceIsComplete( msgs->torrent->completion,
Note: See TracChangeset for help on using the changeset viewer.