mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +00:00
Optimise allKeysForObject:
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@10199 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
2a17202eae
commit
901b88c57a
1 changed files with 7 additions and 3 deletions
|
@ -474,6 +474,8 @@ static SEL appSel;
|
|||
id o1 = (*myObj)(self, objSel, k);
|
||||
id o2 = (*otherObj)(other, objSel, k);
|
||||
|
||||
if (o1 == o2)
|
||||
continue;
|
||||
if ([o1 isEqual: o2] == NO)
|
||||
return NO;
|
||||
}
|
||||
|
@ -534,9 +536,9 @@ static SEL appSel;
|
|||
|
||||
- (NSArray*) allKeysForObject: (id)anObject
|
||||
{
|
||||
unsigned c = [self count];
|
||||
unsigned c;
|
||||
|
||||
if (c == 0)
|
||||
if (anObject == nil || (c = [self count]) == 0)
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
@ -553,7 +555,9 @@ static SEL appSel;
|
|||
c = 0;
|
||||
while ((k = (*nxtObj)(e, nxtSel)) != nil)
|
||||
{
|
||||
if ((*eqObj)(anObject, eqSel, (*myObj)(self, objSel, k)))
|
||||
id o = (*myObj)(self, objSel, k);
|
||||
|
||||
if (o == anObject || (*eqObj)(anObject, eqSel, o))
|
||||
{
|
||||
a[c++] = k;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue