Ignore:
Timestamp:
Dec 30, 2008, 3:29:09 AM (12 years ago)
Author:
charles
Message:

(trunk libT) eliminate a couple more unnecessary malloc() + free() pairs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/fdlimit.c

    r7439 r7543  
    262262                   uint64_t     desiredFileSize )
    263263{
    264     int                  i, winner = -1;
     264    int i, winner = -1;
    265265    struct tr_openfile * o;
    266     char               * filename;
     266    char filename[MAX_PATH_LENGTH];
    267267
    268268    assert( folder && *folder );
     
    270270    assert( doWrite == 0 || doWrite == 1 );
    271271
    272     filename = tr_buildPath( folder, torrentFile, NULL );
    273     dbgmsg( "looking for file '%s', writable %c", filename,
    274             doWrite ? 'y' : 'n' );
     272    tr_snprintf( filename, sizeof( filename ), "%s%c%s", folder, TR_PATH_DELIMITER, torrentFile );
     273    dbgmsg( "looking for file '%s', writable %c", filename, doWrite ? 'y' : 'n' );
    275274
    276275    tr_lockLock( gFd->lock );
     
    362361        if( err ) {
    363362            tr_lockUnlock( gFd->lock );
    364             tr_free( filename );
    365363            errno = err;
    366364            return -1;
     
    377375    o->closeWhenDone = 0;
    378376    o->date = tr_date( );
    379     tr_free( filename );
    380377    tr_lockUnlock( gFd->lock );
    381378    return o->fd;
Note: See TracChangeset for help on using the changeset viewer.