Ignore:
Timestamp:
Jan 4, 2009, 4:59:15 PM (12 years ago)
Author:
charles
Message:

(trunk libT) minor tr_ptrArray API cleanup

File:
1 edited

Legend:

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

    r7597 r7614  
    620620    assert( torrentIsLocked( t ) );
    621621
    622     peers = (const tr_peer**) TR_PTR_ARRAY_DATA( &t->peers );
    623     peerCount = TR_PTR_ARRAY_LENGTH( &t->peers );
     622    peers = (const tr_peer**) tr_ptrArrayBase( &t->peers );
     623    peerCount = tr_ptrArraySize( &t->peers );
    624624
    625625    /* make a list of the pieces that we want but don't have */
     
    791791    peers = getPeersUploadingToClient( t, &peerCount );
    792792    webseedCount = tr_ptrArraySize( &t->webseeds );
    793     webseeds = tr_memdup( TR_PTR_ARRAY_DATA( &t->webseeds ),
     793    webseeds = tr_memdup( tr_ptrArrayBase( &t->webseeds ),
    794794                          webseedCount * sizeof( tr_webseed* ) );
    795795
     
    874874    tordbg( t, "got a block; cancelling any duplicate requests from peers %"PRIu32":%"PRIu32"->%"PRIu32, index, offset, length );
    875875
    876     peerCount = TR_PTR_ARRAY_LENGTH( &t->peers );
    877     peers = (tr_peer**) TR_PTR_ARRAY_DATA( &t->peers );
     876    peerCount = tr_ptrArraySize( &t->peers );
     877    peers = (tr_peer**) tr_ptrArrayBase( &t->peers );
    878878    for( i=0; i<peerCount; ++i )
    879879        if( peers[i]->msgs )
     
    11041104                {
    11051105                    int i;
    1106                     int peerCount = TR_PTR_ARRAY_LENGTH( &t->peers );
    1107                     tr_peer ** peers = (tr_peer**) TR_PTR_ARRAY_DATA( &t->peers );
     1106                    int peerCount = tr_ptrArraySize( &t->peers );
     1107                    tr_peer ** peers = (tr_peer**) tr_ptrArrayBase( &t->peers );
    11081108                    for( i=0; i<peerCount; ++i )
    11091109                        tr_peerMsgsHave( peers[i]->msgs, p );
     
    15021502    {
    15031503        int i;
    1504         const tr_peer ** peers = (const tr_peer**) TR_PTR_ARRAY_DATA( &t->peers );
    1505         const int peerCount = TR_PTR_ARRAY_LENGTH( &t->peers );
     1504        const tr_peer ** peers = (const tr_peer**) tr_ptrArrayBase( &t->peers );
     1505        const int peerCount = tr_ptrArraySize( &t->peers );
    15061506        /* for now, this will waste memory on torrents that have both
    15071507         * ipv6 and ipv4 peers */
     
    16621662    interval = tor->info.pieceCount / (float)tabCount;
    16631663    isSeed = tor && ( tr_cpGetStatus ( &tor->completion ) == TR_SEED );
    1664     peers = (const tr_peer **) TR_PTR_ARRAY_DATA( &t->peers );
    1665     peerCount = TR_PTR_ARRAY_LENGTH( &t->peers );
     1664    peers = (const tr_peer **) tr_ptrArrayBase( &t->peers );
     1665    peerCount = tr_ptrArraySize( &t->peers );
    16661666
    16671667    memset( tab, 0, tabCount );
     
    16981698    t = getExistingTorrent( (tr_peerMgr*)manager, torrentHash );
    16991699    pieces = tr_bitfieldNew( t->tor->info.pieceCount );
    1700     peerCount = TR_PTR_ARRAY_LENGTH( &t->peers );
    1701     peers = (const tr_peer**) TR_PTR_ARRAY_DATA( &t->peers );
     1700    peerCount = tr_ptrArraySize( &t->peers );
     1701    peers = (const tr_peer**) tr_ptrArrayBase( &t->peers );
    17021702    for( i=0; i<peerCount; ++i )
    17031703        tr_bitfieldOr( pieces, peers[i]->have );
     
    17411741
    17421742    t = getExistingTorrent( (tr_peerMgr*)manager, torrentHash );
    1743     peers = (const tr_peer **) TR_PTR_ARRAY_DATA( &t->peers );
    1744     size = TR_PTR_ARRAY_LENGTH( &t->peers );
     1743    peers = (const tr_peer **) tr_ptrArrayBase( &t->peers );
     1744    size = tr_ptrArraySize( &t->peers );
    17451745
    17461746    *setmePeersKnown           = tr_ptrArraySize( &t->pool );
     
    17761776    }
    17771777
    1778     webseeds = (const tr_webseed**) TR_PTR_ARRAY_DATA( &t->webseeds );
    1779     size = TR_PTR_ARRAY_LENGTH( &t->webseeds );
     1778    webseeds = (const tr_webseed**) tr_ptrArrayBase( &t->webseeds );
     1779    size = tr_ptrArraySize( &t->webseeds );
    17801780    for( i=0; i<size; ++i )
    17811781        if( tr_webseedIsActive( webseeds[i] ) )
     
    17991799
    18001800    t = getExistingTorrent( (tr_peerMgr*)manager, torrentHash );
    1801     webseeds = (const tr_webseed**) TR_PTR_ARRAY_DATA( &t->webseeds );
    1802     webseedCount = TR_PTR_ARRAY_LENGTH( &t->webseeds );
     1801    webseeds = (const tr_webseed**) tr_ptrArrayBase( &t->webseeds );
     1802    webseedCount = tr_ptrArraySize( &t->webseeds );
    18031803    assert( webseedCount == t->tor->info.webseedCount );
    18041804    ret = tr_new0( float, webseedCount );
     
    18331833
    18341834    t = getExistingTorrent( (tr_peerMgr*)manager, torrentHash );
    1835     size = TR_PTR_ARRAY_LENGTH( &t->peers );
    1836     peers = (const tr_peer**) TR_PTR_ARRAY_DATA( &t->peers );
     1835    size = tr_ptrArraySize( &t->peers );
     1836    peers = (const tr_peer**) tr_ptrArrayBase( &t->peers );
    18371837    ret = tr_new0( tr_peer_stat, size );
    18381838
     
    19341934{
    19351935    int i, size, unchokedInterested;
    1936     const int peerCount = TR_PTR_ARRAY_LENGTH( &t->peers );
    1937     tr_peer ** peers = (tr_peer**) TR_PTR_ARRAY_DATA( &t->peers );
     1936    const int peerCount = tr_ptrArraySize( &t->peers );
     1937    tr_peer ** peers = (tr_peer**) tr_ptrArrayBase( &t->peers );
    19381938    struct ChokeData * choke = tr_new0( struct ChokeData, peerCount );
    19391939    const int chokeAll = !tr_torrentIsPieceTransferAllowed( t->tor, TR_CLIENT_TO_PEER );
Note: See TracChangeset for help on using the changeset viewer.