From 52cd591d5cdeb9ca2fad41919a8fa86b6a83e510 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Mon, 9 Jun 2008 23:05:14 +0000 Subject: [PATCH] (libT) make tr_torrentAmountFinished() much faster when the torrent is complete --- libtransmission/completion.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/libtransmission/completion.c b/libtransmission/completion.c index f7cd86083..39735644a 100644 --- a/libtransmission/completion.c +++ b/libtransmission/completion.c @@ -304,14 +304,19 @@ tr_cpHaveTotal( const tr_completion * cp ) void tr_cpGetAmountDone( const tr_completion * cp, float * tab, int tabCount ) { + int i; + const int isComplete = tr_cpGetStatus ( cp ) == TR_CP_COMPLETE; const int tabSpan = cp->tor->blockCount / tabCount; tr_block_index_t block_i = 0; - int tab_i; - for( tab_i=0; tab_i