Ignore:
Timestamp:
Jan 2, 2009, 5:01:55 PM (12 years ago)
Author:
charles
Message:

(trunk libT) avoid some unnecessary memory fragmentation... for composited objects that have a tr_completion, contain the it directly rather than a pointer to one allocated elsewhere on the heap.

File:
1 edited

Legend:

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

    r7566 r7578  
    629629    for( i = 0; i < inf->pieceCount; ++i )
    630630        if( !tor->info.pieces[i].dnd
    631                 && !tr_cpPieceIsComplete( tor->completion, i ) )
     631                && !tr_cpPieceIsComplete( &tor->completion, i ) )
    632632            pool[poolSize++] = i;
    633633
     
    650650            setme->pendingRequestCount = getPieceRequests( t, piece );
    651651            setme->missingBlockCount
    652                          = tr_cpMissingBlocksInPiece( tor->completion, piece );
     652                         = tr_cpMissingBlocksInPiece( &tor->completion, piece );
    653653
    654654            for( k = 0; k < peerCount; ++k )
     
    712712        i->blockIndex = 0;
    713713        for( block=b; block!=e; ++block )
    714             if( !tr_cpBlockIsComplete( tor->completion, block ) )
     714            if( !tr_cpBlockIsComplete( &tor->completion, block ) )
    715715                i->blocks[i->blockCount++] = block;
    716716    }
     
    10821082            tr_block_index_t block = _tr_block( tor, e->pieceIndex, e->offset );
    10831083
    1084             tr_cpBlockAdd( tor->completion, block );
     1084            tr_cpBlockAdd( &tor->completion, block );
    10851085            decrementPieceRequests( t, e->pieceIndex );
    10861086
    10871087            broadcastGotBlock( t, e->pieceIndex, e->offset, e->length );
    10881088
    1089             if( tr_cpPieceIsComplete( tor->completion, e->pieceIndex ) )
     1089            if( tr_cpPieceIsComplete( &tor->completion, e->pieceIndex ) )
    10901090            {
    10911091                const tr_piece_index_t p = e->pieceIndex;
     
    16641664    tor = t->tor;
    16651665    interval = tor->info.pieceCount / (float)tabCount;
    1666     isSeed = tor && ( tr_cpGetStatus ( tor->completion ) == TR_SEED );
     1666    isSeed = tor && ( tr_cpGetStatus ( &tor->completion ) == TR_SEED );
    16671667    peers = (const tr_peer **) TR_PTR_ARRAY_DATA( &t->peers );
    16681668    peerCount = TR_PTR_ARRAY_LENGTH( &t->peers );
     
    16741674        const int piece = i * interval;
    16751675
    1676         if( isSeed || tr_cpPieceIsComplete( tor->completion, piece ) )
     1676        if( isSeed || tr_cpPieceIsComplete( &tor->completion, piece ) )
    16771677            tab[i] = -1;
    16781678        else if( peerCount ) {
     
    20752075        if( atom->flags & ADDED_F_SEED_FLAG )
    20762076            peerHasEverything = TRUE;
    2077         else if( peer->progress < tr_cpPercentDone( tor->completion ) )
     2077        else if( peer->progress < tr_cpPercentDone( &tor->completion ) )
    20782078            peerHasEverything = FALSE;
    20792079        else {
    2080             tr_bitfield * tmp = tr_bitfieldDup( tr_cpPieceBitfield( tor->completion ) );
     2080            tr_bitfield * tmp = tr_bitfieldDup( tr_cpPieceBitfield( &tor->completion ) );
    20812081            tr_bitfieldDifference( tmp, peer->have );
    20822082            peerHasEverything = tr_bitfieldCountTrueBits( tmp ) == 0;
Note: See TracChangeset for help on using the changeset viewer.