1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-26 01:27:28 +00:00

if no webseeds, avoid some unneeded work when generating the list

This commit is contained in:
Mitchell Livingston 2010-02-07 01:56:17 +00:00
parent 7de86fd404
commit d835f48828

View file

@ -890,26 +890,28 @@ int trashDataFile(const char * filename)
- (NSArray *) webSeeds
{
const NSInteger webSeedCount = fInfo->webseedCount;
NSMutableArray * webSeeds = [NSMutableArray arrayWithCapacity: webSeedCount];
NSMutableArray * webSeeds = [NSMutableArray arrayWithCapacity: fInfo->webseedCount];
float * dlSpeeds = tr_torrentWebSpeeds(fHandle);
for (NSInteger i = 0; i < webSeedCount; i++)
if (fInfo->webseedCount > 0)
{
NSMutableDictionary * dict = [NSMutableDictionary dictionaryWithCapacity: 3];
float * dlSpeeds = tr_torrentWebSpeeds(fHandle);
[dict setObject: [self name] forKey: @"Name"];
[dict setObject: [NSString stringWithUTF8String: fInfo->webseeds[i]] forKey: @"Address"];
for (NSInteger i = 0; i < fInfo->webseedCount; i++)
{
NSMutableDictionary * dict = [NSMutableDictionary dictionaryWithCapacity: 3];
[dict setObject: [self name] forKey: @"Name"];
[dict setObject: [NSString stringWithUTF8String: fInfo->webseeds[i]] forKey: @"Address"];
if (dlSpeeds[i] != -1.0)
[dict setObject: [NSNumber numberWithFloat: dlSpeeds[i]] forKey: @"DL From Rate"];
[webSeeds addObject: dict];
}
if (dlSpeeds[i] != -1.0)
[dict setObject: [NSNumber numberWithFloat: dlSpeeds[i]] forKey: @"DL From Rate"];
[webSeeds addObject: dict];
tr_free(dlSpeeds);
}
tr_free(dlSpeeds);
return webSeeds;
}