mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +00:00
([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:
parent
65531e035c
commit
e74c56158b
1 changed files with 26 additions and 6 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue