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