Skip to content

Bring -compare: implementations inline with macos #508

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions Source/GSString.m
Original file line number Diff line number Diff line change
Expand Up @@ -3662,9 +3662,7 @@ - (NSComparisonResult) compare: (NSString*)aString
}
GS_RANGE_CHECK(aRange, _count);
if (aString == nil)
[NSException raise: NSInvalidArgumentException
format: @"[%@ -%@] nil string argument",
NSStringFromClass([self class]), NSStringFromSelector(_cmd)];
return NSOrderedDescending;
if (GSObjCIsInstance(aString) == NO)
[NSException raise: NSInvalidArgumentException
format: @"[%@ -%@] not a string argument",
Expand Down Expand Up @@ -4041,9 +4039,7 @@ - (NSComparisonResult) compare: (NSString*)aString
}
GS_RANGE_CHECK(aRange, _count);
if (aString == nil)
[NSException raise: NSInvalidArgumentException
format: @"[%@ -%@] nil string argument",
NSStringFromClass([self class]), NSStringFromSelector(_cmd)];
return NSOrderedDescending;
if (GSObjCIsInstance(aString) == NO)
[NSException raise: NSInvalidArgumentException
format: @"[%@ -%@] not a string argument",
Expand Down Expand Up @@ -4497,9 +4493,7 @@ - (NSComparisonResult) compare: (NSString*)aString
}
GS_RANGE_CHECK(aRange, _count);
if (aString == nil)
[NSException raise: NSInvalidArgumentException
format: @"[%@ -%@] nil string argument",
NSStringFromClass([self class]), NSStringFromSelector(_cmd)];
return NSOrderedDescending;
if (GSObjCIsInstance(aString) == NO)
[NSException raise: NSInvalidArgumentException
format: @"[%@ -%@] not a string argument",
Expand Down
3 changes: 1 addition & 2 deletions Source/NSDate.m
Original file line number Diff line number Diff line change
Expand Up @@ -396,8 +396,7 @@ - (NSComparisonResult) compare: (NSDate*)otherDate
}
if (unlikely(otherDate == nil))
{
[NSException raise: NSInvalidArgumentException
format: @"nil argument for compare:"];
return NSOrderedSame;
}

if (IS_CONCRETE_CLASS(otherDate))
Expand Down
3 changes: 1 addition & 2 deletions Source/NSString.m
Original file line number Diff line number Diff line change
Expand Up @@ -5914,8 +5914,7 @@ - (NSComparisonResult) compare: (NSString *)string
GS_RANGE_CHECK(compareRange, [self length]);
if (nil == string)
{
[NSException raise: NSInvalidArgumentException
format: @"compare with nil"];
return NSOrderedDescending;
}

/* A nil locale should trigger POSIX collation (i.e. 'A'-'Z' sort
Expand Down