([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:
mccallum 1995-11-03 22:22:02 +00:00
parent 0a2df82052
commit e2953be450

View file

@ -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];
}