Ignore:
Timestamp:
Jun 27, 2007, 2:54:31 PM (14 years ago)
Author:
charles
Message:

Modified tr_torrentCanAdd() to give the new functionality BMW suggests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/completion.c

    r2187 r2207  
    5252    tr_completion_t * cp;
    5353
    54     cp                   = malloc( sizeof( tr_completion_t ) );
     54    cp                   = tr_new( tr_completion_t, 1 );
    5555    cp->tor              = tor;
    5656    cp->blockBitfield    = tr_bitfieldNew( tor->blockCount );
    57     cp->blockDownloaders = malloc( tor->blockCount );
     57    cp->blockDownloaders = tr_new( uint8_t, tor->blockCount );
    5858    cp->pieceBitfield    = tr_bitfieldNew( tor->info.pieceCount );
    59     cp->missingBlocks    = malloc( tor->info.pieceCount * sizeof( int ) );
    60     cp->completeBlocks   = malloc( tor->info.pieceCount * sizeof( int ) );
     59    cp->missingBlocks    = tr_new( int, tor->info.pieceCount );
     60    cp->completeBlocks   = tr_new( int, tor->info.pieceCount );
    6161
    6262    cp->nBlocksInLastPiece = tr_pieceCountBlocks ( tor->info.pieceCount - 1 );
     
    7171void tr_cpClose( tr_completion_t * cp )
    7272{
     73    tr_free(         cp->completeBlocks );
     74    tr_free(         cp->missingBlocks );
     75    tr_bitfieldFree( cp->pieceBitfield );
     76    tr_free(         cp->blockDownloaders );
    7377    tr_bitfieldFree( cp->blockBitfield );
    74     free(            cp->blockDownloaders );
    75     tr_bitfieldFree( cp->pieceBitfield );
    76     free(            cp->missingBlocks );
    77     free(            cp->completeBlocks );
    78     free(            cp );
     78    tr_free(         cp );
    7979}
    8080
     
    264264    end   = start + count;
    265265
    266     pool     = malloc( count * sizeof( int ) );
     266    pool     = tr_new( int, count );
    267267    poolSize = 0;
    268268    min      = 255;
     
    295295    }
    296296
    297     free( pool );
     297    tr_free( pool );
    298298    return ret;
    299299}
Note: See TracChangeset for help on using the changeset viewer.