]> granicus.if.org Git - transmission/commitdiff
trivial improvement to compareSeedProbabilities()
authorMitchell Livingston <livings124@transmissionbt.com>
Sun, 13 Jun 2010 20:54:03 +0000 (20:54 +0000)
committerMitchell Livingston <livings124@transmissionbt.com>
Sun, 13 Jun 2010 20:54:03 +0000 (20:54 +0000)
libtransmission/peer-mgr.c

index c5a450c543085dbbcbdf8e1d0e033aab5122561e..a148b11f54421708ff53013a95eb7fcd5cf8862b 100644 (file)
@@ -3285,10 +3285,12 @@ compareSeedProbabilities( int a, int b )
        2. prefer leechers to unknown
        3. prefer unknown to seeds (FIXME: this is a simplistic test) */
     if( a == 100 ) a = 101;
+    else if( a == -1 ) a = 100;
+
     if( b == 100 ) b = 101;
-    if( a == -1 ) a = 100;
-    if( b == -1 ) b = 100;
-    return a - b;
+    else if( b == -1 ) b = 100;
+
+    return a > b ? 1 : -1;
 }
 
 static tr_bool