From 2328456a4a70aa3a24aa9bed6044cca391769f27 Mon Sep 17 00:00:00 2001 From: Jordan Lee Date: Fri, 1 Apr 2011 04:33:35 +0000 Subject: [PATCH] (trunk libT) simplify tr_torrent's hasAnyLocalData() to be more readable, and also to avoid yet another unnecessary malloc() and free() --- libtransmission/torrent.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/libtransmission/torrent.c b/libtransmission/torrent.c index 178f64313..22f6a0ca3 100644 --- a/libtransmission/torrent.c +++ b/libtransmission/torrent.c @@ -762,21 +762,12 @@ static bool hasAnyLocalData( const tr_torrent * tor ) { tr_file_index_t i; - bool has_local_data = false; - const tr_file_index_t n = tor->info.fileCount; - - for( i=0; iinfo.fileCount; ++i ) + if( tr_torrentFindFile2( tor, i, NULL, NULL ) ) + return true; - return has_local_data; + return false; } static bool -- 2.40.0