get rid of unnecessary comparison

This commit is contained in:
Mitchell Livingston 2007-02-09 12:52:32 +00:00
parent 3f57aea897
commit 727e167705
1 changed files with 1 additions and 5 deletions

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;