mirror of
https://github.com/gnustep/libs-base.git
synced 2025-06-01 09:02:01 +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
|
+ array
|
||||||
{
|
{
|
||||||
return [[[[self _concreteClass] alloc] init]
|
return [[[self alloc] init]
|
||||||
autorelease];
|
autorelease];
|
||||||
}
|
}
|
||||||
|
|
||||||
+ arrayWithObject: anObject
|
+ arrayWithObject: anObject
|
||||||
{
|
{
|
||||||
[NSException raise:NSInvalidArgumentException
|
if (anObject == nil)
|
||||||
format:@"Tried to add nil"];
|
[NSException raise:NSInvalidArgumentException
|
||||||
return [[[[self _concreteClass] alloc] initWithObjects:&anObject count:1]
|
format:@"Tried to add nil"];
|
||||||
|
return [[[self alloc] initWithObjects:&anObject count:1]
|
||||||
autorelease];
|
autorelease];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,7 +181,7 @@ static Class NSMutableArray_concrete_class;
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, firstObject);
|
va_start(ap, firstObject);
|
||||||
self = [[[self _concreteClass] alloc] initWithObjects:firstObject rest:ap];
|
self = [[self alloc] initWithObjects:firstObject rest:ap];
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
return [self autorelease];
|
return [self autorelease];
|
||||||
}
|
}
|
||||||
|
@ -380,7 +381,7 @@ static Class NSMutableArray_concrete_class;
|
||||||
|
|
||||||
+ arrayWithCapacity: (unsigned)numItems
|
+ arrayWithCapacity: (unsigned)numItems
|
||||||
{
|
{
|
||||||
return [[[[self _mutableConcreteClass] alloc] initWithCapacity:numItems]
|
return [[[self alloc] initWithCapacity:numItems]
|
||||||
autorelease];
|
autorelease];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue