minor optimisation ... avoid unnecessary retain/release

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@38187 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2014-11-20 09:40:23 +00:00
parent a39e2a5b6b
commit bc50e26e2a

View file

@ -443,27 +443,29 @@ static inline BOOL timerInvalidated(NSTimer *t)
NSAutoreleasePool *arp = [NSAutoreleasePool new];
GSRunLoopPerformer *array[count];
NSMapEnumerator enumerator;
GSRunLoopCtxt *context;
GSRunLoopCtxt *original;
void *mode;
unsigned i;
found = YES;
/*
* Copy the array - because we have to cancel the requests
* before firing.
/* We have to remove the performers before firing, so we copy
* the pointers withoutm releasing the objects, and then set
* the array to be empty.
*/
for (i = 0; i < count; i++)
{
array[i] = RETAIN(GSIArrayItemAtIndex(performers, i).obj);
array[i] = GSIArrayItemAtIndex(performers, i).obj;
}
performers->count = 0;
/*
* Remove the requests that we are about to fire from all modes.
/* Remove the requests that we are about to fire from all modes.
*/
original = context;
enumerator = NSEnumerateMapTable(_contextMap);
while (NSNextMapEnumeratorPair(&enumerator, &mode, (void**)&context))
{
if (context != nil)
if (context != nil && context != original)
{
GSIArray performers = context->performers;
unsigned tmpCount = GSIArrayCount(performers);