Changeset 12294


Ignore:
Timestamp:
Apr 1, 2011, 4:33:35 AM (11 years ago)
Author:
jordan
Message:

(trunk libT) simplify tr_torrent's hasAnyLocalData() to be more readable, and also to avoid yet another unnecessary malloc() and free()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/torrent.c

    r12280 r12294  
    763763{
    764764    tr_file_index_t i;
    765     bool has_local_data = false;
    766     const tr_file_index_t n = tor->info.fileCount;
    767 
    768     for( i=0; i<n && !has_local_data; ++i )
    769     {
    770         struct stat sb;
    771         char * filename = tr_torrentFindFile( tor, i );
    772 
    773         if( filename && !stat( filename, &sb ) )
    774             has_local_data = true;
    775 
    776         tr_free( filename );
    777     }
    778 
    779     return has_local_data;
     765
     766    for( i=0; i<tor->info.fileCount; ++i )
     767        if( tr_torrentFindFile2( tor, i, NULL, NULL ) )
     768            return true;
     769
     770    return false;
    780771}
    781772
Note: See TracChangeset for help on using the changeset viewer.