([NSMutableArrayNonCore -removeObject:]): Replace with version that

removes all objects equal to argument.
([NSMutableArrayNonCore -removeObjectIdenticalTo:]): Likewise.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1491 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Andrew McCallum 1996-04-30 14:25:22 +00:00
parent 65531e035c
commit e74c56158b

View file

@ -472,16 +472,36 @@ static Class NSMutableArray_concrete_class;
- (void) removeObjectIdenticalTo: anObject
{
int i = [self indexOfObjectIdenticalTo:anObject];
if (i != NSNotFound)
[self removeObjectAtIndex: i];
unsigned index;
/* Retain the object. Yuck, but necessary in case the array holds
the last reference to anObject. */
/* xxx Is there an alternative to this expensive retain/release? */
[anObject retain];
for (index = [self indexOfObjectIdenticalTo: anObject];
index != NO_INDEX;
index = [self indexOfObjectIdenticalTo: anObject])
[self removeObjectAtIndex: index];
[anObject release];
}
- (void) removeObject: anObject
{
int i = [self indexOfObject:anObject];
if (i != NSNotFound)
[self removeObjectAtIndex:i];
unsigned index;
/* Retain the object. Yuck, but necessary in case the array holds
the last reference to anObject. */
/* xxx Is there an alternative to this expensive retain/release? */
[anObject retain];
for (index = [self indexOfObject: anObject];
index != NO_INDEX;
index = [self indexOfObject: anObject])
[self removeObjectAtIndex: index];
[anObject release];
}
- (void) removeAllObjects