get rid of unnecessary comparison
This commit is contained in:
parent
3f57aea897
commit
727e167705
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue