1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-24 16:52:39 +00:00

get rid of unnecessary comparison

This commit is contained in:
Mitchell Livingston 2007-02-09 12:52:32 +00:00
parent 3f57aea897
commit 727e167705

View file

@ -111,15 +111,11 @@
- (NSComparisonResult) compareIP: (NSString *) string
{
if ([self isEqualToString: string])
return NSOrderedSame;
NSArray * selfSections = [self componentsSeparatedByString: @"."],
* newSections = [string componentsSeparatedByString: @"."];
if ([selfSections count] != [newSections count])
return [[NSNumber numberWithUnsignedInt: [selfSections count]] compare:
[NSNumber numberWithUnsignedInt: [newSections count]]];
return [selfSections count] > [newSections count] ? NSOrderedDescending : NSOrderedAscending;
NSEnumerator * selfSectionsEnum = [selfSections objectEnumerator], * newSectionsEnum = [newSections objectEnumerator];
NSString * selfString, * newString;