mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 16:30:41 +00:00
([NSArray +array]): Use +alloc, not _concreteClass. This
makes [NSMutableArray +array] and friends do the right thing. ([NSArray +arrayWithObjects:]): Likewise. ([NSMutableArray +arrayWithCapacity:]): Likewise. ([NSArray +arrayWithObject:]): Likewise; and fix condition on exception. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@659 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
0a2df82052
commit
e2953be450
1 changed files with 7 additions and 6 deletions
|
@ -122,15 +122,16 @@ static Class NSMutableArray_concrete_class;
|
|||
|
||||
+ array
|
||||
{
|
||||
return [[[[self _concreteClass] alloc] init]
|
||||
return [[[self alloc] init]
|
||||
autorelease];
|
||||
}
|
||||
|
||||
+ arrayWithObject: anObject
|
||||
{
|
||||
[NSException raise:NSInvalidArgumentException
|
||||
format:@"Tried to add nil"];
|
||||
return [[[[self _concreteClass] alloc] initWithObjects:&anObject count:1]
|
||||
if (anObject == nil)
|
||||
[NSException raise:NSInvalidArgumentException
|
||||
format:@"Tried to add nil"];
|
||||
return [[[self alloc] initWithObjects:&anObject count:1]
|
||||
autorelease];
|
||||
}
|
||||
|
||||
|
@ -180,7 +181,7 @@ static Class NSMutableArray_concrete_class;
|
|||
{
|
||||
va_list ap;
|
||||
va_start(ap, firstObject);
|
||||
self = [[[self _concreteClass] alloc] initWithObjects:firstObject rest:ap];
|
||||
self = [[self alloc] initWithObjects:firstObject rest:ap];
|
||||
va_end(ap);
|
||||
return [self autorelease];
|
||||
}
|
||||
|
@ -380,7 +381,7 @@ static Class NSMutableArray_concrete_class;
|
|||
|
||||
+ arrayWithCapacity: (unsigned)numItems
|
||||
{
|
||||
return [[[[self _mutableConcreteClass] alloc] initWithCapacity:numItems]
|
||||
return [[[self alloc] initWithCapacity:numItems]
|
||||
autorelease];
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue