Changeset 2481


Ignore:
Timestamp:
Jul 24, 2007, 5:08:45 PM (15 years ago)
Author:
charles
Message:

remove unused function tr_cpMostMissingBlockInPiece()

Location:
trunk/libtransmission
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/completion.c

    r2479 r2481  
    231231}
    232232
    233 int tr_cpMostMissingBlockInPiece( const tr_completion_t * cp,
    234                                   int                     piece,
    235                                   int                   * downloaders )
    236 {
    237     tr_torrent_t * tor = cp->tor;
    238     int start, count, end, i;
    239     int * pool, poolSize, min, ret;
    240 
    241     start = tr_pieceStartBlock( piece );
    242     count = tr_cpCountBlocks( cp, piece );
    243     end   = start + count;
    244 
    245     pool     = tr_new( int, count );
    246     poolSize = 0;
    247     min      = 255;
    248 
    249     for( i = start; i < end; i++ )
    250     {
    251         if( tr_cpBlockIsComplete( cp, i ) || cp->blockDownloaders[i] > min )
    252         {
    253             continue;
    254         }
    255         if( cp->blockDownloaders[i] < min )
    256         {
    257             min      = cp->blockDownloaders[i];
    258             poolSize = 0;
    259         }
    260         if( cp->blockDownloaders[i] <= min )
    261         {
    262             pool[poolSize++] = i;
    263         }
    264     }
    265 
    266     if( poolSize > 0 )
    267     {
    268         ret = pool[0];
    269         *downloaders = min;
    270     }
    271     else
    272     {
    273         ret = -1;
    274     }
    275 
    276     tr_free( pool );
    277     return ret;
    278 }
    279 
    280 
    281233/***
    282234****
  • trunk/libtransmission/completion.h

    r2149 r2481  
    6060int                   tr_cpMissingBlocksForPiece( const tr_completion_t * cp, int piece );
    6161int                   tr_cpMissingBlockInPiece( const tr_completion_t *, int piece );
    62 int                   tr_cpMostMissingBlockInPiece( const tr_completion_t *, int piece,
    63                                                     int * downloaders );
    6462
    6563#endif
  • trunk/libtransmission/peer.c

    r2444 r2481  
    669669            int unused;
    670670            const int piece = pool[i];
    671             const int block = endgame
    672                 ? tr_cpMostMissingBlockInPiece( tor->completion, piece, &unused)
    673                 : tr_cpMissingBlockInPiece ( tor->completion, piece );
     671            const int block = tr_cpMissingBlockInPiece ( tor->completion, piece );
    674672
    675673            if( block>=0 )
  • trunk/libtransmission/torrent.c

    r2480 r2481  
    13731373}
    13741374
     1375int _tr_pieceStartBlock( const tr_torrent_t * tor, int piece )
     1376{
     1377    return (piece * tor->info.pieceSize) / tor->blockSize;
     1378}
     1379
    13751380int _tr_blockSize( const tr_torrent_t * tor, int block )
    13761381{
     
    13981403}
    13991404
    1400 int _tr_pieceStartBlock( const tr_torrent_t * tor, int piece )
    1401 {
    1402     const tr_info_t * inf = &tor->info;
    1403     return piece * ( inf->pieceSize / tor->blockSize );
    1404 }
    1405 
    14061405int _tr_pieceSize( const tr_torrent_t * tor, int piece )
    14071406{
Note: See TracChangeset for help on using the changeset viewer.