From 963ffae92df1f7300ecbed7d3ef2e1ced1b396be Mon Sep 17 00:00:00 2001 From: rfm Date: Mon, 7 Sep 2009 16:25:04 +0000 Subject: [PATCH] remove publicly visible ivars for future abi stability. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@28626 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 8 + Headers/Foundation/NSConnection.h | 40 +- Source/GSInternal.h | 6 +- Source/NSConnection.m | 839 +++++++++++++++++------------- Source/NSOperation.m | 4 +- 5 files changed, 483 insertions(+), 414 deletions(-) diff --git a/ChangeLog b/ChangeLog index 927332d6f..e549bdf80 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2009-09-07 Richard Frith-Macdonald + + * Headers/Foundation/NSConnection.h: + * Source/NSConnection.m: + Remove ivars from public header. + Improve debug by reporting the connections's registered name and/or + the name of the remote port it is connecting to. + 2009-09-07 Richard Frith-Macdonald * Source/NSRunLoop.m: diff --git a/Headers/Foundation/NSConnection.h b/Headers/Foundation/NSConnection.h index 3e04a8fbf..3be2c2cee 100644 --- a/Headers/Foundation/NSConnection.h +++ b/Headers/Foundation/NSConnection.h @@ -95,45 +95,7 @@ GS_EXPORT NSString* const NSConnectionProxyCount; /* Objects received */ @interface NSConnection : NSObject { @private - BOOL _isValid; - BOOL _independentQueueing; - BOOL _authenticateIn; - BOOL _authenticateOut; - BOOL _multipleThreads; - BOOL _shuttingDown; - BOOL _useKeepalive; - BOOL _keepaliveWait; - NSPort *_receivePort; - NSPort *_sendPort; - unsigned _requestDepth; - unsigned _messageCount; - unsigned _reqOutCount; - unsigned _reqInCount; - unsigned _repOutCount; - unsigned _repInCount; -#ifndef _IN_CONNECTION_M -#define GSIMapTable void* -#endif - GSIMapTable _localObjects; - GSIMapTable _localTargets; - GSIMapTable _remoteProxies; - GSIMapTable _replyMap; -#ifndef _IN_CONNECTION_M -#undef GSIMapTable -#endif - NSTimeInterval _replyTimeout; - NSTimeInterval _requestTimeout; - NSMutableArray *_requestModes; - NSMutableArray *_runLoops; - NSMutableArray *_requestQueue; - id _delegate; - NSRecursiveLock *_refGate; - NSMutableArray *_cachedDecoders; - NSMutableArray *_cachedEncoders; - NSString *_registeredName; - NSPortNameServer *_nameServer; - int _lastKeepalive; - void *_reserved; // For expansion + id _internal; } + (NSArray*) allConnections; diff --git a/Source/GSInternal.h b/Source/GSInternal.h index b5243f2b1..9d617e989 100644 --- a/Source/GSInternal.h +++ b/Source/GSInternal.h @@ -85,8 +85,8 @@ DESTROY(_internal); #undef internal #define internal ((GSInternal*)_internal) -#undef GSIVr -#define GSIVar(X,Y) (((X ## Internal*)_internal)->Y) +#undef GSIVar +#define GSIVar(X,Y) (((GSInternal*)(X->_internal))->Y) #else /* defined(__GNUC__) */ @@ -114,7 +114,7 @@ DESTROY(_internal); #undef internal #define internal self #undef GSIVar -#define GSIVar(X,Y) (self->Y) +#define GSIVar(X,Y) ((X)->Y) #endif /* defined(__GNUC__) */ diff --git a/Source/NSConnection.m b/Source/NSConnection.m index 483a537dc..af6eeca4c 100644 --- a/Source/NSConnection.m +++ b/Source/NSConnection.m @@ -244,7 +244,81 @@ stringFromMsgType(int type) -@interface NSConnection (Private) +#define GSInternal NSConnectionInternal +#include "GSInternal.h" +GS_BEGIN_INTERNAL(NSConnection) + BOOL _isValid; + BOOL _independentQueueing; + BOOL _authenticateIn; + BOOL _authenticateOut; + BOOL _multipleThreads; + BOOL _shuttingDown; + BOOL _useKeepalive; + BOOL _keepaliveWait; + NSPort *_receivePort; + NSPort *_sendPort; + unsigned _requestDepth; + unsigned _messageCount; + unsigned _reqOutCount; + unsigned _reqInCount; + unsigned _repOutCount; + unsigned _repInCount; + GSIMapTable _localObjects; + GSIMapTable _localTargets; + GSIMapTable _remoteProxies; + GSIMapTable _replyMap; + NSTimeInterval _replyTimeout; + NSTimeInterval _requestTimeout; + NSMutableArray *_requestModes; + NSMutableArray *_runLoops; + NSMutableArray *_requestQueue; + id _delegate; + NSRecursiveLock *_refGate; + NSMutableArray *_cachedDecoders; + NSMutableArray *_cachedEncoders; + NSString *_remoteName; + NSString *_registeredName; + NSPortNameServer *_nameServer; + int _lastKeepalive; +GS_END_INTERNAL(NSConnection) + + +#define IisValid (internal->_isValid) +#define IindependentQueueing (internal->_independentQueueing) +#define IauthenticateIn (internal->_authenticateIn) +#define IauthenticateOut (internal->_authenticateOut) +#define ImultipleThreads (internal->_multipleThreads) +#define IshuttingDown (internal->_shuttingDown) +#define IuseKeepalive (internal->_useKeepalive) +#define IkeepaliveWait (internal->_keepaliveWait) +#define IreceivePort (internal->_receivePort) +#define IsendPort (internal->_sendPort) +#define IrequestDepth (internal->_requestDepth) +#define ImessageCount (internal->_messageCount) +#define IreqOutCount (internal->_reqOutCount) +#define IreqInCount (internal->_reqInCount) +#define IrepOutCount (internal->_repOutCount) +#define IrepInCount (internal->_repInCount) +#define IlocalObjects (internal->_localObjects) +#define IlocalTargets (internal->_localTargets) +#define IremoteProxies (internal->_remoteProxies) +#define IreplyMap (internal->_replyMap) +#define IreplyTimeout (internal->_replyTimeout) +#define IrequestTimeout (internal->_requestTimeout) +#define IrequestModes (internal->_requestModes) +#define IrunLoops (internal->_runLoops) +#define IrequestQueue (internal->_requestQueue) +#define Idelegate (internal->_delegate) +#define IrefGate (internal->_refGate) +#define IcachedDecoders (internal->_cachedDecoders) +#define IcachedEncoders (internal->_cachedEncoders) +#define IremoteName (internal->_remoteName) +#define IregisteredName (internal->_registeredName) +#define InameServer (internal->_nameServer) +#define IlastKeepalive (internal->_lastKeepalive) + +@interface NSConnection(Private) + - (void) handlePortMessage: (NSPortMessage*)msg; - (void) _runInNewThread; + (void) setDebug: (int)val; @@ -273,8 +347,6 @@ stringFromMsgType(int type) + (void) _threadWillExit: (NSNotification*)notification; @end -#define _proxiesGate _refGate -#define _queueGate _refGate /* class defaults */ @@ -492,6 +564,7 @@ static NSLock *cached_proxies_gate = nil; con = [self connectionWithReceivePort: recvPort sendPort: sendPort]; } + ASSIGNCOPY(GSIVar(con, _remoteName), n); } } return con; @@ -738,23 +811,23 @@ static NSLock *cached_proxies_gate = nil; */ - (void) addRequestMode: (NSString*)mode { - M_LOCK(_refGate); + M_LOCK(IrefGate); if ([self isValid] == YES) { - if ([_requestModes containsObject: mode] == NO) + if ([IrequestModes containsObject: mode] == NO) { - unsigned c = [_runLoops count]; + unsigned c = [IrunLoops count]; while (c-- > 0) { - NSRunLoop *loop = [_runLoops objectAtIndex: c]; + NSRunLoop *loop = [IrunLoops objectAtIndex: c]; - [_receivePort addConnection: self toRunLoop: loop forMode: mode]; + [IreceivePort addConnection: self toRunLoop: loop forMode: mode]; } - [_requestModes addObject: mode]; + [IrequestModes addObject: mode]; } } - M_UNLOCK(_refGate); + M_UNLOCK(IrefGate); } /** @@ -763,23 +836,23 @@ static NSLock *cached_proxies_gate = nil; */ - (void) addRunLoop: (NSRunLoop*)loop { - M_LOCK(_refGate); + M_LOCK(IrefGate); if ([self isValid] == YES) { - if ([_runLoops indexOfObjectIdenticalTo: loop] == NSNotFound) + if ([IrunLoops indexOfObjectIdenticalTo: loop] == NSNotFound) { - unsigned c = [_requestModes count]; + unsigned c = [IrequestModes count]; while (c-- > 0) { - NSString *mode = [_requestModes objectAtIndex: c]; + NSString *mode = [IrequestModes objectAtIndex: c]; - [_receivePort addConnection: self toRunLoop: loop forMode: mode]; + [IreceivePort addConnection: self toRunLoop: loop forMode: mode]; } - [_runLoops addObject: loop]; + [IrunLoops addObject: loop]; } } - M_UNLOCK(_refGate); + M_UNLOCK(IrefGate); } - (void) dealloc @@ -787,6 +860,10 @@ static NSLock *cached_proxies_gate = nil; if (debug_connection) NSLog(@"deallocating %@", self); [self finalize]; + if (internal != nil) + { + GS_DESTROY_INTERNAL(NSConnection); + } [super dealloc]; } @@ -795,13 +872,15 @@ static NSLock *cached_proxies_gate = nil; */ - (id) delegate { - return GS_GC_UNHIDE(_delegate); + return GS_GC_UNHIDE(Idelegate); } - (NSString*) description { - return [NSString stringWithFormat: @"%@ recv: %@ send %@", - [super description], [self receivePort], [self sendPort]]; + return [NSString stringWithFormat: @"%@ local: '%@',%@ remote '%@',%@", + [super description], + IregisteredName ? (id)IregisteredName : (id)@"", [self receivePort], + IremoteName ? (id)IremoteName : (id)@"", [self sendPort]]; } /** @@ -813,7 +892,7 @@ static NSLock *cached_proxies_gate = nil; */ - (void) enableMultipleThreads { - _multipleThreads = YES; + ImultipleThreads = YES; } /** @@ -823,7 +902,7 @@ static NSLock *cached_proxies_gate = nil; */ - (BOOL) independentConversationQueueing { - return _independentQueueing; + return IindependentQueueing; } /** @@ -888,8 +967,9 @@ static NSLock *cached_proxies_gate = nil; NSConnection *conn; NSRunLoop *loop; id del; - NSZone *z = NSDefaultMallocZone(); + NSZone *z; + z = NSDefaultMallocZone(); /* * If the receive port is nil, deallocate connection and return nil. */ @@ -930,6 +1010,10 @@ static NSLock *cached_proxies_gate = nil; return self; } + /* Create our private data structure. + */ + GS_CREATE_INTERNAL(NSConnection); + /* * The parent connection is the one whose send and receive ports are * both the same as our receive port. @@ -944,41 +1028,42 @@ static NSLock *cached_proxies_gate = nil; M_LOCK(connection_table_gate); - _isValid = YES; - _receivePort = RETAIN(r); - _sendPort = RETAIN(s); - _messageCount = 0; - _repOutCount = 0; - _reqOutCount = 0; - _repInCount = 0; - _reqInCount = 0; + IisValid = YES; + IreceivePort = RETAIN(r); + IsendPort = RETAIN(s); + ImessageCount = 0; + IrepOutCount = 0; + IreqOutCount = 0; + IrepInCount = 0; + IreqInCount = 0; /* * These arrays cache NSPortCoder objects */ if (cacheCoders == YES) { - _cachedDecoders = [NSMutableArray new]; - _cachedEncoders = [NSMutableArray new]; + IcachedDecoders = [NSMutableArray new]; + IcachedEncoders = [NSMutableArray new]; } /* * This is used to queue up incoming NSPortMessages representing requests * that can't immediately be dealt with. */ - _requestQueue = [NSMutableArray new]; + IrequestQueue = [NSMutableArray new]; /* * This maps request sequence numbers to the NSPortCoder objects representing * replies arriving from the remote connection. */ #if GS_WITH_GC - _replyMap = (GSIMapTable)NSAllocateCollectable(sizeof(GSIMapTable_t), + IreplyMap + = (GSIMapTable)NSAllocateCollectable(sizeof(GSIMapTable_t), NSScannedOption); #else - _replyMap = (GSIMapTable)NSZoneMalloc(z, sizeof(GSIMapTable_t)); + IreplyMap = (GSIMapTable)NSZoneMalloc(z, sizeof(GSIMapTable_t)); #endif - GSIMapInitWithZoneAndCapacity(_replyMap, z, 4); + GSIMapInitWithZoneAndCapacity(IreplyMap, z, 4); /* * This maps (void*)obj to (id)obj. The obj's are retained. @@ -986,38 +1071,44 @@ static NSLock *cached_proxies_gate = nil; * the object's address, and don't want to send the -hash message to it. */ #if GS_WITH_GC - _localObjects= (GSIMapTable)NSAllocateCollectable(sizeof(GSIMapTable_t), + IlocalObjects + = (GSIMapTable)NSAllocateCollectable(sizeof(GSIMapTable_t), NSScannedOption); #else - _localObjects = (GSIMapTable)NSZoneMalloc(z, sizeof(GSIMapTable_t)); + IlocalObjects + = (GSIMapTable)NSZoneMalloc(z, sizeof(GSIMapTable_t)); #endif - GSIMapInitWithZoneAndCapacity(_localObjects, z, 4); + GSIMapInitWithZoneAndCapacity(IlocalObjects, z, 4); /* * This maps handles for local objects to their local proxies. */ #if GS_WITH_GC - _localTargets = (GSIMapTable)NSAllocateCollectable(sizeof(GSIMapTable_t), + IlocalTargets + = (GSIMapTable)NSAllocateCollectable(sizeof(GSIMapTable_t), NSScannedOption); #else - _localTargets = (GSIMapTable)NSZoneMalloc(z, sizeof(GSIMapTable_t)); + IlocalTargets + = (GSIMapTable)NSZoneMalloc(z, sizeof(GSIMapTable_t)); #endif - GSIMapInitWithZoneAndCapacity(_localTargets, z, 4); + GSIMapInitWithZoneAndCapacity(IlocalTargets, z, 4); /* * This maps targets to remote proxies. */ #if GS_WITH_GC - _remoteProxies = (GSIMapTable)NSAllocateCollectable(sizeof(GSIMapTable_t), + IremoteProxies + = (GSIMapTable)NSAllocateCollectable(sizeof(GSIMapTable_t), NSScannedOption); #else - _remoteProxies = (GSIMapTable)NSZoneMalloc(z, sizeof(GSIMapTable_t)); + IremoteProxies + = (GSIMapTable)NSZoneMalloc(z, sizeof(GSIMapTable_t)); #endif - GSIMapInitWithZoneAndCapacity(_remoteProxies, z, 4); + GSIMapInitWithZoneAndCapacity(IremoteProxies, z, 4); - _requestDepth = 0; - _delegate = nil; - _refGate = [GSLazyRecursiveLock new]; + IrequestDepth = 0; + Idelegate = nil; + IrefGate = [GSLazyRecursiveLock new]; /* * Some attributes are inherited from the parent if possible. @@ -1026,44 +1117,46 @@ static NSLock *cached_proxies_gate = nil; { unsigned count; - _multipleThreads = parent->_multipleThreads; - _independentQueueing = parent->_independentQueueing; - _replyTimeout = parent->_replyTimeout; - _requestTimeout = parent->_requestTimeout; - _runLoops = [parent->_runLoops mutableCopy]; - count = [parent->_requestModes count]; - _requestModes = [[NSMutableArray alloc] initWithCapacity: count]; + ImultipleThreads = GSIVar(parent, _multipleThreads); + IindependentQueueing = GSIVar(parent, _independentQueueing); + IreplyTimeout = GSIVar(parent, _replyTimeout); + IrequestTimeout = GSIVar(parent, _requestTimeout); + IrunLoops = [GSIVar(parent, _runLoops) mutableCopy]; + count = [GSIVar(parent, _requestModes) count]; + IrequestModes + = [[NSMutableArray alloc] initWithCapacity: count]; while (count-- > 0) { - [self addRequestMode: [parent->_requestModes objectAtIndex: count]]; + [self addRequestMode: + [GSIVar(parent, _requestModes) objectAtIndex: count]]; } - if (parent->_useKeepalive == YES) + if (GSIVar(parent, _useKeepalive) == YES) { [self _enableKeepalive]; } } else { - _multipleThreads = NO; - _independentQueueing = NO; - _replyTimeout = 1.0E12; - _requestTimeout = 1.0E12; + ImultipleThreads = NO; + IindependentQueueing = NO; + IreplyTimeout = 1.0E12; + IrequestTimeout = 1.0E12; /* * Set up request modes array and make sure the receiving port * is added to the run loop to get data. */ loop = GSRunLoopForThread(nil); - _runLoops = [[NSMutableArray alloc] initWithObjects: &loop count: 1]; - _requestModes = [[NSMutableArray alloc] initWithCapacity: 2]; + IrunLoops = [[NSMutableArray alloc] initWithObjects: &loop count: 1]; + IrequestModes = [[NSMutableArray alloc] initWithCapacity: 2]; [self addRequestMode: NSDefaultRunLoopMode]; [self addRequestMode: NSConnectionReplyMode]; - _useKeepalive = NO; + IuseKeepalive = NO; /* * If we have no parent, we must handle incoming packets on our * receive port ourself - so we set ourself up as the port delegate. */ - [_receivePort setDelegate: self]; + [IreceivePort setDelegate: self]; } /* Ask the delegate for permission, (OpenStep-style and GNUstep-style). */ @@ -1137,27 +1230,27 @@ static NSLock *cached_proxies_gate = nil; */ - (void) invalidate { - M_LOCK(_refGate); - if (_isValid == NO) + M_LOCK(IrefGate); + if (IisValid == NO) { - M_UNLOCK(_refGate); + M_UNLOCK(IrefGate); return; } - if (_shuttingDown == NO) + if (IshuttingDown == NO) { - _shuttingDown = YES; + IshuttingDown = YES; /* * Not invalidated as a result of a shutdown from the other end, * so tell the other end it must shut down. */ //[self _shutdown]; } - _isValid = NO; + IisValid = NO; M_LOCK(connection_table_gate); NSHashRemove(connection_table, self); M_UNLOCK(connection_table_gate); - M_UNLOCK(_refGate); + M_UNLOCK(IrefGate); /* * Don't need notifications any more - so remove self as observer. @@ -1167,15 +1260,15 @@ static NSLock *cached_proxies_gate = nil; /* * Make sure we are not registered. */ -#if !defined(__MINGW32__) - if ([_receivePort isKindOfClass: [NSMessagePort class]]) +#if !defined(IMINGW32I) + if ([IreceivePort isKindOfClass: [NSMessagePort class]]) { [self registerName: nil withNameServer: [NSMessagePortNameServer sharedInstance]]; } else #endif - if ([_receivePort isKindOfClass: [NSSocketPort class]]) + if ([IreceivePort isKindOfClass: [NSSocketPort class]]) { [self registerName: nil withNameServer: [NSSocketPortNameServer sharedInstance]]; @@ -1218,16 +1311,16 @@ static NSLock *cached_proxies_gate = nil; * these proxies in case they are keeping us retained when we * might otherwise de deallocated. */ - M_LOCK(_proxiesGate); - if (_localTargets != 0) + M_LOCK(IrefGate); + if (IlocalTargets != 0) { NSMutableArray *targets; - unsigned i = _localTargets->nodeCount; + unsigned i = IlocalTargets->nodeCount; GSIMapEnumerator_t enumerator; GSIMapNode node; targets = [[NSMutableArray alloc] initWithCapacity: i]; - enumerator = GSIMapEnumeratorForMap(_localTargets); + enumerator = GSIMapEnumeratorForMap(IlocalTargets); node = GSIMapEnumeratorNextNode(&enumerator); while (node != 0) { @@ -1239,22 +1332,22 @@ static NSLock *cached_proxies_gate = nil; [self removeLocalObject: [targets objectAtIndex: i]]; } RELEASE(targets); - GSIMapEmptyMap(_localTargets); - NSZoneFree(_localTargets->zone, (void*)_localTargets); - _localTargets = 0; + GSIMapEmptyMap(IlocalTargets); + NSZoneFree(IlocalTargets->zone, (void*)IlocalTargets); + IlocalTargets = 0; } - if (_remoteProxies != 0) + if (IremoteProxies != 0) { - GSIMapEmptyMap(_remoteProxies); - NSZoneFree(_remoteProxies->zone, (void*)_remoteProxies); - _remoteProxies = 0; + GSIMapEmptyMap(IremoteProxies); + NSZoneFree(IremoteProxies->zone, (void*)IremoteProxies); + IremoteProxies = 0; } - if (_localObjects != 0) + if (IlocalObjects != 0) { GSIMapEnumerator_t enumerator; GSIMapNode node; - enumerator = GSIMapEnumeratorForMap(_localObjects); + enumerator = GSIMapEnumeratorForMap(IlocalObjects); node = GSIMapEnumeratorNextNode(&enumerator); while (node != 0) @@ -1262,27 +1355,27 @@ static NSLock *cached_proxies_gate = nil; RELEASE(node->key.obj); node = GSIMapEnumeratorNextNode(&enumerator); } - GSIMapEmptyMap(_localObjects); - NSZoneFree(_localObjects->zone, (void*)_localObjects); - _localObjects = 0; + GSIMapEmptyMap(IlocalObjects); + NSZoneFree(IlocalObjects->zone, (void*)IlocalObjects); + IlocalObjects = 0; } - M_UNLOCK(_proxiesGate); + M_UNLOCK(IrefGate); /* * If we are invalidated, we shouldn't be receiving any event and * should not need to be in any run loops. */ - while ([_runLoops count] > 0) + while ([IrunLoops count] > 0) { - [self removeRunLoop: [_runLoops lastObject]]; + [self removeRunLoop: [IrunLoops lastObject]]; } /* * Invalidate the current conversation so we don't leak. */ - if ([_sendPort isValid] == YES) + if ([IsendPort isValid] == YES) { - [[_sendPort conversation: _receivePort] invalidate]; + [[IsendPort conversation: IreceivePort] invalidate]; } RELEASE(self); @@ -1294,7 +1387,7 @@ static NSLock *cached_proxies_gate = nil; */ - (BOOL) isValid { - return _isValid; + return IisValid; } /** @@ -1306,17 +1399,17 @@ static NSLock *cached_proxies_gate = nil; { NSMutableArray *c; - /* Don't assert (_isValid); */ - M_LOCK(_proxiesGate); - if (_localObjects != 0) + /* Don't assert (IisValid); */ + M_LOCK(IrefGate); + if (IlocalObjects != 0) { GSIMapEnumerator_t enumerator; GSIMapNode node; - enumerator = GSIMapEnumeratorForMap(_localObjects); + enumerator = GSIMapEnumeratorForMap(IlocalObjects); node = GSIMapEnumeratorNextNode(&enumerator); - c = [NSMutableArray arrayWithCapacity: _localObjects->nodeCount]; + c = [NSMutableArray arrayWithCapacity: IlocalObjects->nodeCount]; while (node != 0) { [c addObject: node->key.obj]; @@ -1327,7 +1420,7 @@ static NSLock *cached_proxies_gate = nil; { c = [NSArray array]; } - M_UNLOCK(_proxiesGate); + M_UNLOCK(IrefGate); return c; } @@ -1338,7 +1431,7 @@ static NSLock *cached_proxies_gate = nil; */ - (BOOL) multipleThreadsEnabled { - return _multipleThreads; + return ImultipleThreads; } /** @@ -1346,7 +1439,7 @@ static NSLock *cached_proxies_gate = nil; */ - (NSPort*) receivePort { - return _receivePort; + return IreceivePort; } /** @@ -1374,16 +1467,16 @@ static NSLock *cached_proxies_gate = nil; if (name != nil) { - result = [svr registerPort: _receivePort forName: name]; + result = [svr registerPort: IreceivePort forName: name]; } if (result == YES) { - if (_registeredName != nil) + if (IregisteredName != nil) { - [_nameServer removePort: _receivePort forName: _registeredName]; + [InameServer removePort: IreceivePort forName: IregisteredName]; } - ASSIGN(_registeredName, name); - ASSIGN(_nameServer, svr); + ASSIGN(IregisteredName, name); + ASSIGN(InameServer, svr); } return result; } @@ -1418,17 +1511,17 @@ static NSLock *cached_proxies_gate = nil; { NSMutableArray *c; - /* Don't assert (_isValid); */ - M_LOCK(_proxiesGate); - if (_remoteProxies != 0) + /* Don't assert (IisValid); */ + M_LOCK(IrefGate); + if (IremoteProxies != 0) { GSIMapEnumerator_t enumerator; GSIMapNode node; - enumerator = GSIMapEnumeratorForMap(_remoteProxies); + enumerator = GSIMapEnumeratorForMap(IremoteProxies); node = GSIMapEnumeratorNextNode(&enumerator); - c = [NSMutableArray arrayWithCapacity: _remoteProxies->nodeCount]; + c = [NSMutableArray arrayWithCapacity: IremoteProxies->nodeCount]; while (node != 0) { [c addObject: node->key.obj]; @@ -1439,7 +1532,7 @@ static NSLock *cached_proxies_gate = nil; { c = [NSMutableArray array]; } - M_UNLOCK(_proxiesGate); + M_UNLOCK(IrefGate); return c; } @@ -1448,22 +1541,22 @@ static NSLock *cached_proxies_gate = nil; */ - (void) removeRequestMode: (NSString*)mode { - M_LOCK(_refGate); - if (_requestModes != nil && [_requestModes containsObject: mode]) + M_LOCK(IrefGate); + if (IrequestModes != nil && [IrequestModes containsObject: mode]) { - unsigned c = [_runLoops count]; + unsigned c = [IrunLoops count]; while (c-- > 0) { - NSRunLoop *loop = [_runLoops objectAtIndex: c]; + NSRunLoop *loop = [IrunLoops objectAtIndex: c]; - [_receivePort removeConnection: self + [IreceivePort removeConnection: self fromRunLoop: loop forMode: mode]; } - [_requestModes removeObject: mode]; + [IrequestModes removeObject: mode]; } - M_UNLOCK(_refGate); + M_UNLOCK(IrefGate); } /** @@ -1471,27 +1564,27 @@ static NSLock *cached_proxies_gate = nil; */ - (void) removeRunLoop: (NSRunLoop*)loop { - M_LOCK(_refGate); - if (_runLoops != nil) + M_LOCK(IrefGate); + if (IrunLoops != nil) { - unsigned pos = [_runLoops indexOfObjectIdenticalTo: loop]; + unsigned pos = [IrunLoops indexOfObjectIdenticalTo: loop]; if (pos != NSNotFound) { - unsigned c = [_requestModes count]; + unsigned c = [IrequestModes count]; while (c-- > 0) { - NSString *mode = [_requestModes objectAtIndex: c]; + NSString *mode = [IrequestModes objectAtIndex: c]; - [_receivePort removeConnection: self - fromRunLoop: [_runLoops objectAtIndex: pos] + [IreceivePort removeConnection: self + fromRunLoop: [IrunLoops objectAtIndex: pos] forMode: mode]; } - [_runLoops removeObjectAtIndex: pos]; + [IrunLoops removeObjectAtIndex: pos]; } } - M_UNLOCK(_refGate); + M_UNLOCK(IrefGate); } /** @@ -1503,7 +1596,7 @@ static NSLock *cached_proxies_gate = nil; */ - (NSTimeInterval) replyTimeout { - return _replyTimeout; + return IreplyTimeout; } /** @@ -1514,9 +1607,9 @@ static NSLock *cached_proxies_gate = nil; { NSArray *c; - M_LOCK(_refGate); - c = AUTORELEASE([_requestModes copy]); - M_UNLOCK(_refGate); + M_LOCK(IrefGate); + c = AUTORELEASE([IrequestModes copy]); + M_UNLOCK(IrefGate); return c; } @@ -1528,7 +1621,7 @@ static NSLock *cached_proxies_gate = nil; */ - (NSTimeInterval) requestTimeout { - return _requestTimeout; + return IrequestTimeout; } /** @@ -1538,7 +1631,7 @@ static NSLock *cached_proxies_gate = nil; */ - (id) rootObject { - return rootObjectForInPort(_receivePort); + return rootObjectForInPort(IreceivePort); } /** @@ -1553,14 +1646,14 @@ static NSLock *cached_proxies_gate = nil; NSDistantObject *newProxy = nil; int seq_num; - NSParameterAssert(_receivePort); - NSParameterAssert(_isValid); + NSParameterAssert(IreceivePort); + NSParameterAssert(IisValid); /* * If this is a server connection without a remote end, its root proxy * is the same as its root object. */ - if (_receivePort == _sendPort) + if (IreceivePort ==IsendPort) { return [self rootObject]; } @@ -1590,7 +1683,7 @@ static NSLock *cached_proxies_gate = nil; */ - (NSPort*) sendPort { - return _sendPort; + return IsendPort; } /** @@ -1600,10 +1693,10 @@ static NSLock *cached_proxies_gate = nil; */ - (void) setDelegate: (id)anObj { - _delegate = GS_GC_HIDE(anObj); - _authenticateIn = + Idelegate = GS_GC_HIDE(anObj); + IauthenticateIn = [anObj respondsToSelector: @selector(authenticateComponents:withData:)]; - _authenticateOut = + IauthenticateOut = [anObj respondsToSelector: @selector(authenticationDataForComponents:)]; } @@ -1616,7 +1709,7 @@ static NSLock *cached_proxies_gate = nil; */ - (void) setIndependentConversationQueueing: (BOOL)flag { - _independentQueueing = flag; + IindependentQueueing = flag; } /** @@ -1629,7 +1722,7 @@ static NSLock *cached_proxies_gate = nil; - (void) setReplyTimeout: (NSTimeInterval)to { if (to <= 0.0 || to > 1.0E12) to = 1.0E12; - _replyTimeout = to; + IreplyTimeout = to; } /** @@ -1638,24 +1731,24 @@ static NSLock *cached_proxies_gate = nil; */ - (void) setRequestMode: (NSString*)mode { - M_LOCK(_refGate); - if (_requestModes != nil) + M_LOCK(IrefGate); + if (IrequestModes != nil) { - while ([_requestModes count] > 0 - && [_requestModes objectAtIndex: 0] != mode) + while ([IrequestModes count] > 0 + && [IrequestModes objectAtIndex: 0] != mode) { - [self removeRequestMode: [_requestModes objectAtIndex: 0]]; + [self removeRequestMode: [IrequestModes objectAtIndex: 0]]; } - while ([_requestModes count] > 1) + while ([IrequestModes count] > 1) { - [self removeRequestMode: [_requestModes objectAtIndex: 1]]; + [self removeRequestMode: [IrequestModes objectAtIndex: 1]]; } - if (mode != nil && [_requestModes count] == 0) + if (mode != nil && [IrequestModes count] == 0) { [self addRequestMode: mode]; } } - M_UNLOCK(_refGate); + M_UNLOCK(IrefGate); } /** @@ -1665,7 +1758,7 @@ static NSLock *cached_proxies_gate = nil; - (void) setRequestTimeout: (NSTimeInterval)to { if (to <= 0.0 || to > 1.0E12) to = 1.0E12; - _requestTimeout = to; + IrequestTimeout = to; } /** @@ -1673,13 +1766,13 @@ static NSLock *cached_proxies_gate = nil; */ - (void) setRootObject: (id)anObj { - setRootObjectForInPort(anObj, _receivePort); -#if defined(__MINGW32__) + setRootObjectForInPort(anObj, IreceivePort); +#if defined(IMINGW32I) /* On ms-windows, the operating system does not inform us when the remote * client of a message port goes away ... so we need to enable keepalive * to detect that condition. */ - if ([_receivePort isKindOfClass: [NSMessagePort class]]) + if ([IreceivePort isKindOfClass: [NSMessagePort class]]) { [self _enableKeepalive]; } @@ -1725,36 +1818,36 @@ static NSLock *cached_proxies_gate = nil; d = [NSMutableDictionary dictionaryWithCapacity: 8]; - M_LOCK(_refGate); + M_LOCK(IrefGate); /* * These are in OPENSTEP 4.2 */ - o = [NSNumber numberWithUnsignedInt: _repInCount]; + o = [NSNumber numberWithUnsignedInt: IrepInCount]; [d setObject: o forKey: NSConnectionRepliesReceived]; - o = [NSNumber numberWithUnsignedInt: _repOutCount]; + o = [NSNumber numberWithUnsignedInt: IrepOutCount]; [d setObject: o forKey: NSConnectionRepliesSent]; - o = [NSNumber numberWithUnsignedInt: _reqInCount]; + o = [NSNumber numberWithUnsignedInt: IreqInCount]; [d setObject: o forKey: NSConnectionRequestsReceived]; - o = [NSNumber numberWithUnsignedInt: _reqOutCount]; + o = [NSNumber numberWithUnsignedInt: IreqOutCount]; [d setObject: o forKey: NSConnectionRequestsSent]; /* * These are GNUstep extras */ o = [NSNumber numberWithUnsignedInt: - _localTargets ? _localTargets->nodeCount : 0]; + IlocalTargets ? IlocalTargets->nodeCount : 0]; [d setObject: o forKey: NSConnectionLocalCount]; o = [NSNumber numberWithUnsignedInt: - _remoteProxies ? _remoteProxies->nodeCount : 0]; + IremoteProxies ? IremoteProxies->nodeCount : 0]; [d setObject: o forKey: NSConnectionProxyCount]; o = [NSNumber numberWithUnsignedInt: - _replyMap ? _replyMap->nodeCount : 0]; + IreplyMap ? IreplyMap->nodeCount : 0]; [d setObject: o forKey: @"NSConnectionReplyQueue"]; - o = [NSNumber numberWithUnsignedInt: [_requestQueue count]]; + o = [NSNumber numberWithUnsignedInt: [IrequestQueue count]]; [d setObject: o forKey: @"NSConnectionRequestQueue"]; - M_UNLOCK(_refGate); + M_UNLOCK(IrefGate); return d; } @@ -1792,41 +1885,41 @@ static NSLock *cached_proxies_gate = nil; [self invalidate]; /* Remove rootObject from root_object_map if this is last connection */ - if (_receivePort != nil && existingConnection(_receivePort, nil) == nil) + if (IreceivePort != nil && existingConnection(IreceivePort, nil) == nil) { - setRootObjectForInPort(nil, _receivePort); + setRootObjectForInPort(nil, IreceivePort); } /* Remove receive port from run loop. */ [self setRequestMode: nil]; - DESTROY(_requestModes); - DESTROY(_runLoops); + DESTROY(IrequestModes); + DESTROY(IrunLoops); /* * Finished with ports - releasing them may generate a notification * If we are the receive port delagate, try to shift responsibility. */ - if ([_receivePort delegate] == self) + if ([IreceivePort delegate] == self) { - NSConnection *root = existingConnection(_receivePort, _receivePort); + NSConnection *root = existingConnection(IreceivePort, IreceivePort); if (root == nil) { - root = existingConnection(_receivePort, nil); + root = existingConnection(IreceivePort, nil); } - [_receivePort setDelegate: root]; + [IreceivePort setDelegate: root]; } - DESTROY(_receivePort); - DESTROY(_sendPort); + DESTROY(IreceivePort); + DESTROY(IsendPort); - DESTROY(_requestQueue); - if (_replyMap != 0) + DESTROY(IrequestQueue); + if (IreplyMap != 0) { GSIMapEnumerator_t enumerator; GSIMapNode node; - enumerator = GSIMapEnumeratorForMap(_replyMap); + enumerator = GSIMapEnumeratorForMap(IreplyMap); node = GSIMapEnumeratorNextNode(&enumerator); while (node != 0) @@ -1837,15 +1930,18 @@ static NSLock *cached_proxies_gate = nil; } node = GSIMapEnumeratorNextNode(&enumerator); } - GSIMapEmptyMap(_replyMap); - NSZoneFree(_replyMap->zone, (void*)_replyMap); - _replyMap = 0; + GSIMapEmptyMap(IreplyMap); + NSZoneFree(IreplyMap->zone, (void*)IreplyMap); + IreplyMap = 0; } - DESTROY(_cachedDecoders); - DESTROY(_cachedEncoders); + DESTROY(IcachedDecoders); + DESTROY(IcachedEncoders); + + DESTROY(IremoteName); + + DESTROY(IrefGate); - DESTROY(_refGate); RELEASE(arp); } @@ -1953,11 +2049,11 @@ static void retEncoder (DOContext *ctxt) /* Encode the method on an RMC, and send it. */ - NSParameterAssert (_isValid); + NSParameterAssert (IisValid); - if ([_runLoops indexOfObjectIdenticalTo: runLoop] == NSNotFound) + if ([IrunLoops indexOfObjectIdenticalTo: runLoop] == NSNotFound) { - if (_multipleThreads == NO) + if (ImultipleThreads == NO) { [NSException raise: NSObjectInaccessibleException format: @"Forwarding message in wrong thread"]; @@ -2042,11 +2138,11 @@ static void retEncoder (DOContext *ctxt) /* * Since we don't need a response, we can remove the placeholder from - * the _replyMap. However, in case the other end has already sent us + * the IreplyMap. However, in case the other end has already sent us * a response, we must check for it and scrap it if necessary. */ - M_LOCK(_refGate); - node = GSIMapNodeForKey(_replyMap, (GSIMapKey)ctxt.seq); + M_LOCK(IrefGate); + node = GSIMapNodeForKey(IreplyMap, (GSIMapKey)ctxt.seq); if (node != 0 && node->value.obj != dummyObject) { BOOL is_exception = NO; @@ -2059,8 +2155,8 @@ static void retEncoder (DOContext *ctxt) NSLog(@"Got response with %@", NSStringFromSelector(sel)); [self _doneInRmc: node->value.obj]; } - GSIMapRemoveKey(_replyMap, (GSIMapKey)ctxt.seq); - M_UNLOCK(_refGate); + GSIMapRemoveKey(IreplyMap, (GSIMapKey)ctxt.seq); + M_UNLOCK(IrefGate); retframe = alloca(sizeof(void*)); /* Dummy value for void return. */ } else @@ -2098,9 +2194,9 @@ static void retEncoder (DOContext *ctxt) DOContext ctxt; NSRunLoop *runLoop = GSRunLoopForThread(nil); - if ([_runLoops indexOfObjectIdenticalTo: runLoop] == NSNotFound) + if ([IrunLoops indexOfObjectIdenticalTo: runLoop] == NSNotFound) { - if (_multipleThreads == NO) + if (ImultipleThreads == NO) { [NSException raise: NSObjectInaccessibleException format: @"Forwarding message in wrong thread"]; @@ -2113,7 +2209,7 @@ static void retEncoder (DOContext *ctxt) /* Encode the method on an RMC, and send it. */ - NSParameterAssert (_isValid); + NSParameterAssert (IisValid); /* get the method types from the selector */ type = [[inv methodSignature] methodType]; @@ -2174,11 +2270,11 @@ static void retEncoder (DOContext *ctxt) /* * Since we don't need a response, we can remove the placeholder from - * the _replyMap. However, in case the other end has already sent us + * the IreplyMap. However, in case the other end has already sent us * a response, we must check for it and scrap it if necessary. */ - M_LOCK(_refGate); - node = GSIMapNodeForKey(_replyMap, (GSIMapKey)ctxt.seq); + M_LOCK(IrefGate); + node = GSIMapNodeForKey(IreplyMap, (GSIMapKey)ctxt.seq); if (node != 0 && node->value.obj != dummyObject) { BOOL is_exception = NO; @@ -2192,8 +2288,8 @@ static void retEncoder (DOContext *ctxt) NSLog(@"Got response with %@", NSStringFromSelector(sel)); [self _doneInRmc: node->value.obj]; } - GSIMapRemoveKey(_replyMap, (GSIMapKey)ctxt.seq); - M_UNLOCK(_refGate); + GSIMapRemoveKey(IreplyMap, (GSIMapKey)ctxt.seq); + M_UNLOCK(IrefGate); } else { @@ -2218,8 +2314,8 @@ static void retEncoder (DOContext *ctxt) int seq_num; NSData *data; - NSParameterAssert(_receivePort); - NSParameterAssert (_isValid); + NSParameterAssert(IreceivePort); + NSParameterAssert (IisValid); op = [self _makeOutRmc: 0 generate: &seq_num reply: YES]; [op encodeValueOfObjCType: ":" at: &sel]; [op encodeValueOfObjCType: @encode(unsigned) at: &target]; @@ -2306,7 +2402,7 @@ static void retEncoder (DOContext *ctxt) NSLog(@" connection is %@", conn); } - if (conn->_authenticateIn == YES + if (GSIVar(conn, _authenticateIn) == YES && (type == METHOD_REQUEST || type == METHOD_REPLY)) { NSData *d; @@ -2353,32 +2449,34 @@ static void retEncoder (DOContext *ctxt) * If REPLY_DEPTH is non-zero, we may still want to service it now * if independent_queuing is NO. */ - M_LOCK(conn->_queueGate); - if (conn->_requestDepth == 0 || conn->_independentQueueing == NO) + M_LOCK(GSIVar(conn, _refGate)); + if (GSIVar(conn, _requestDepth) == 0 + || GSIVar(conn, _independentQueueing) == NO) { - conn->_requestDepth++; - M_UNLOCK(conn->_queueGate); + GSIVar(conn, _requestDepth)++; + M_UNLOCK(GSIVar(conn, _refGate)); [conn _service_forwardForProxy: rmc]; // Catches exceptions - M_LOCK(conn->_queueGate); - conn->_requestDepth--; + M_LOCK(GSIVar(conn, _refGate)); + GSIVar(conn, _requestDepth)--; } else { - [conn->_requestQueue addObject: rmc]; + [GSIVar(conn, _requestQueue) addObject: rmc]; } /* * Service any requests that were queued while we * were waiting for replies. */ - while (conn->_requestDepth == 0 && [conn->_requestQueue count] > 0) + while (GSIVar(conn, _requestDepth) == 0 + && [GSIVar(conn, _requestQueue) count] > 0) { - rmc = [conn->_requestQueue objectAtIndex: 0]; - [conn->_requestQueue removeObjectAtIndex: 0]; - M_UNLOCK(conn->_queueGate); + rmc = [GSIVar(conn, _requestQueue) objectAtIndex: 0]; + [GSIVar(conn, _requestQueue) removeObjectAtIndex: 0]; + M_UNLOCK(GSIVar(conn, _refGate)); [conn _service_forwardForProxy: rmc]; // Catches exceptions - M_LOCK(conn->_queueGate); + M_LOCK(GSIVar(conn, _refGate)); } - M_UNLOCK(conn->_queueGate); + M_UNLOCK(GSIVar(conn, _refGate)); break; /* @@ -2395,17 +2493,17 @@ static void retEncoder (DOContext *ctxt) GSIMapNode node; [rmc decodeValueOfObjCType: @encode(int) at: &sequence]; - if (type == ROOTPROXY_REPLY && conn->_keepaliveWait == YES - && sequence == conn->_lastKeepalive) + if (type == ROOTPROXY_REPLY && GSIVar(conn, _keepaliveWait) == YES + && sequence == GSIVar(conn, _lastKeepalive)) { - conn->_keepaliveWait = NO; + GSIVar(conn, _keepaliveWait) = NO; NSDebugMLLog(@"NSConnection", @"Handled keepalive %d on %@", sequence, conn); [self _doneInRmc: rmc]; break; } - M_LOCK(conn->_queueGate); - node = GSIMapNodeForKey(conn->_replyMap, (GSIMapKey)sequence); + M_LOCK(GSIVar(conn, _refGate)); + node = GSIMapNodeForKey(GSIVar(conn, _replyMap), (GSIMapKey)sequence); if (node == 0) { NSDebugMLLog(@"NSConnection", @"Ignoring reply RMC %d on %@", @@ -2425,7 +2523,7 @@ static void retEncoder (DOContext *ctxt) [self _doneInRmc: node->value.obj]; node->value.obj = rmc; } - M_UNLOCK(conn->_queueGate); + M_UNLOCK(GSIVar(conn, _refGate)); } break; @@ -2467,14 +2565,14 @@ static void retEncoder (DOContext *ctxt) { if ([self isValid]) { - if (_keepaliveWait == NO) + if (IkeepaliveWait == NO) { NSPortCoder *op; /* Send out a root proxy request to ping the other end. */ - op = [self _makeOutRmc: 0 generate: &_lastKeepalive reply: NO]; - _keepaliveWait = YES; + op = [self _makeOutRmc: 0 generate: &IlastKeepalive reply: NO]; + IkeepaliveWait = YES; [self _sendOutRmc: op type: ROOTPROXY_REQUEST]; } else @@ -2490,9 +2588,9 @@ static void retEncoder (DOContext *ctxt) */ - (void) _enableKeepalive { - _useKeepalive = YES; /* Set so that child connections will inherit. */ - _keepaliveWait = NO; - if (_receivePort != _sendPort) + IuseKeepalive = YES; /* Set so that child connections will inherit. */ + IkeepaliveWait = NO; + if (IreceivePort !=IsendPort) { /* If this is not a listening connection, we actually enable the * keepalive timing (usng the regular housekeeping notifications) @@ -2616,10 +2714,10 @@ static void callEncoder (DOContext *ctxt) { NSRunLoop *runLoop = GSRunLoopForThread(nil); - NSParameterAssert (_isValid); - if ([_runLoops indexOfObjectIdenticalTo: runLoop] == NSNotFound) + NSParameterAssert (IisValid); + if ([IrunLoops indexOfObjectIdenticalTo: runLoop] == NSNotFound) { - if (_multipleThreads == YES) + if (ImultipleThreads == YES) { [self addRunLoop: runLoop]; } @@ -2648,7 +2746,7 @@ static void callEncoder (DOContext *ctxt) @"Handling message (sig %s) RMC %d from %@", ctxt.type, ctxt.seq, (uintptr_t)self); - _reqInCount++; /* Handling an incoming request. */ + IreqInCount++; /* Handling an incoming request. */ #if defined(USE_LIBFFI) cifframe_do_call (&ctxt, callDecoder, callEncoder); @@ -2668,7 +2766,7 @@ static void callEncoder (DOContext *ctxt) NSLog(@"forwarding exception for (%@) - %@", self, localException); /* Send the exception back to the client. */ - if (_isValid == YES) + if (IisValid == YES) { BOOL is_exception = YES; @@ -2713,12 +2811,12 @@ static void callEncoder (DOContext *ctxt) - (void) _service_rootObject: (NSPortCoder*)rmc { - id rootObject = rootObjectForInPort(_receivePort); + id rootObject = rootObjectForInPort(IreceivePort); int sequence; NSPortCoder *op; - NSParameterAssert(_receivePort); - NSParameterAssert(_isValid); + NSParameterAssert(IreceivePort); + NSParameterAssert(IisValid); NSParameterAssert([rmc connection] == self); [rmc decodeValueOfObjCType: @encode(int) at: &sequence]; @@ -2734,7 +2832,7 @@ static void callEncoder (DOContext *ctxt) unsigned int pos; int sequence; - NSParameterAssert (_isValid); + NSParameterAssert (IisValid); [rmc decodeValueOfObjCType: @encode(int) at: &sequence]; [rmc decodeValueOfObjCType: @encode(typeof(count)) at: &count]; @@ -2777,7 +2875,7 @@ static void callEncoder (DOContext *ctxt) NSDistantObject *local; NSString *response = nil; - NSParameterAssert (_isValid); + NSParameterAssert (IisValid); [rmc decodeValueOfObjCType: @encode(int) at: &sequence]; op = [self _makeOutRmc: sequence generate: 0 reply: NO]; @@ -2789,7 +2887,7 @@ static void callEncoder (DOContext *ctxt) NSLog(@"looking to retain local object with target (0x%x) on (%@)", target, self); - M_LOCK(_proxiesGate); + M_LOCK(IrefGate); local = [self locateLocalTarget: target]; if (local == nil) { @@ -2799,7 +2897,7 @@ static void callEncoder (DOContext *ctxt) { ((ProxyStruct*)local)->_counter++; // Vended on connection. } - M_UNLOCK(_proxiesGate); + M_UNLOCK(IrefGate); [op encodeObject: response]; [self _sendOutRmc: op type: RETAIN_REPLY]; @@ -2807,8 +2905,8 @@ static void callEncoder (DOContext *ctxt) - (void) _shutdown { - NSParameterAssert(_receivePort); - NSParameterAssert (_isValid); + NSParameterAssert(IreceivePort); + NSParameterAssert (IisValid); NS_DURING { NSPortCoder *op; @@ -2823,8 +2921,8 @@ static void callEncoder (DOContext *ctxt) - (void) _service_shutdown: (NSPortCoder*)rmc { - NSParameterAssert (_isValid); - _shuttingDown = YES; // Prevent shutdown being sent back to other end + NSParameterAssert (IisValid); + IshuttingDown = YES; // Prevent shutdown being sent back to other end [self _doneInRmc: rmc]; [self invalidate]; } @@ -2840,8 +2938,8 @@ static void callEncoder (DOContext *ctxt) const char *type; struct objc_method* m; - NSParameterAssert(_receivePort); - NSParameterAssert (_isValid); + NSParameterAssert(IreceivePort); + NSParameterAssert (IisValid); [rmc decodeValueOfObjCType: @encode(int) at: &sequence]; op = [self _makeOutRmc: sequence generate: 0 reply: NO]; @@ -2886,7 +2984,7 @@ static void callEncoder (DOContext *ctxt) NSRunLoop *runLoop; BOOL isLocked = NO; - if (_isValid == NO) + if (IisValid == NO) { [NSException raise: NSObjectInaccessibleException format: @"Connection has been invalidated"]; @@ -2899,9 +2997,9 @@ static void callEncoder (DOContext *ctxt) * get the reply in this thread. */ runLoop = GSRunLoopForThread(nil); - if ([_runLoops indexOfObjectIdenticalTo: runLoop] == NSNotFound) + if ([IrunLoops indexOfObjectIdenticalTo: runLoop] == NSNotFound) { - if (_multipleThreads == YES) + if (ImultipleThreads == YES) { [self addRunLoop: runLoop]; } @@ -2912,7 +3010,7 @@ static void callEncoder (DOContext *ctxt) } } - if (_multipleThreads == YES) + if (ImultipleThreads == YES) { /* Since multiple threads are using this connection, another * thread may read the reply we are waiting for - so we must @@ -2941,21 +3039,21 @@ static void callEncoder (DOContext *ctxt) if (debug_connection > 5) NSLog(@"Waiting for reply sequence %d on %@", sn, self); - M_LOCK(_queueGate); isLocked = YES; - while (_isValid == YES - && (node = GSIMapNodeForKey(_replyMap, (GSIMapKey)sn)) != 0 + M_LOCK(IrefGate); isLocked = YES; + while (IisValid == YES + && (node = GSIMapNodeForKey(IreplyMap, (GSIMapKey)sn)) != 0 && node->value.obj == dummyObject) { NSDate *limit_date; - M_UNLOCK(_queueGate); isLocked = NO; + M_UNLOCK(IrefGate); isLocked = NO; if (start_date == nil) { start_date = [dateClass allocWithZone: NSDefaultMallocZone()]; start_date = [start_date init]; timeout_date = [dateClass allocWithZone: NSDefaultMallocZone()]; timeout_date - = [timeout_date initWithTimeIntervalSinceNow: _replyTimeout]; + = [timeout_date initWithTimeIntervalSinceNow: IreplyTimeout]; } RELEASE(delay_date); delay_date = [dateClass allocWithZone: NSDefaultMallocZone()]; @@ -2992,8 +3090,8 @@ static void callEncoder (DOContext *ctxt) && (limit_date == timeout_date)) || [timeout_date timeIntervalSinceNow] <= 0.0) { - M_LOCK(_queueGate); isLocked = YES; - node = GSIMapNodeForKey(_replyMap, (GSIMapKey)sn); + M_LOCK(IrefGate); isLocked = YES; + node = GSIMapNodeForKey(IreplyMap, (GSIMapKey)sn); break; } else if (warned == NO && [start_date timeIntervalSinceNow] <= -300.0) @@ -3002,7 +3100,7 @@ static void callEncoder (DOContext *ctxt) NSLog(@"WARNING ... waiting for reply %u since %@ on %@", sn, start_date, self); } - M_LOCK(_queueGate); isLocked = YES; + M_LOCK(IrefGate); isLocked = YES; } if (node == 0) { @@ -3011,9 +3109,9 @@ static void callEncoder (DOContext *ctxt) else { rmc = node->value.obj; - GSIMapRemoveKey(_replyMap, (GSIMapKey)sn); + GSIMapRemoveKey(IreplyMap, (GSIMapKey)sn); } - M_UNLOCK(_queueGate); isLocked = NO; + M_UNLOCK(IrefGate); isLocked = NO; TEST_RELEASE(start_date); TEST_RELEASE(delay_date); TEST_RELEASE(timeout_date); @@ -3024,7 +3122,7 @@ static void callEncoder (DOContext *ctxt) } if (rmc == dummyObject) { - if (_isValid == YES) + if (IisValid == YES) { [NSException raise: NSPortTimeoutException format: @"timed out waiting for reply"]; @@ -3040,7 +3138,7 @@ static void callEncoder (DOContext *ctxt) { if (isLocked == YES) { - M_UNLOCK(_queueGate); + M_UNLOCK(IrefGate); } [localException raise]; } @@ -3053,23 +3151,23 @@ static void callEncoder (DOContext *ctxt) - (void) _doneInReply: (NSPortCoder*)c { [self _doneInRmc: c]; - _repInCount++; + IrepInCount++; } - (void) _doneInRmc: (NSPortCoder*)c { - M_LOCK(_refGate); + M_LOCK(IrefGate); if (debug_connection > 5) { NSLog(@"done rmc 0x%x", c); } - if (cacheCoders == YES && _cachedDecoders != nil) + if (cacheCoders == YES && IcachedDecoders != nil) { - [_cachedDecoders addObject: c]; + [IcachedDecoders addObject: c]; } [c dispatch]; /* Tell NSPortCoder to release the connection. */ RELEASE(c); - M_UNLOCK(_refGate); + M_UNLOCK(IrefGate); } /* @@ -3078,11 +3176,11 @@ static void callEncoder (DOContext *ctxt) */ - (void) _failInRmc: (NSPortCoder*)c { - M_LOCK(_refGate); - if (cacheCoders == YES && _cachedDecoders != nil - && [_cachedDecoders indexOfObjectIdenticalTo: c] == NSNotFound) + M_LOCK(IrefGate); + if (cacheCoders == YES && IcachedDecoders != nil + && [IcachedDecoders indexOfObjectIdenticalTo: c] == NSNotFound) { - [_cachedDecoders addObject: c]; + [IcachedDecoders addObject: c]; } if (debug_connection > 5) { @@ -3090,7 +3188,7 @@ static void callEncoder (DOContext *ctxt) } [c dispatch]; /* Tell NSPortCoder to release the connection. */ RELEASE(c); - M_UNLOCK(_refGate); + M_UNLOCK(IrefGate); } /* @@ -3099,15 +3197,15 @@ static void callEncoder (DOContext *ctxt) */ - (void) _failOutRmc: (NSPortCoder*)c { - M_LOCK(_refGate); - if (cacheCoders == YES && _cachedEncoders != nil - && [_cachedEncoders indexOfObjectIdenticalTo: c] == NSNotFound) + M_LOCK(IrefGate); + if (cacheCoders == YES && IcachedEncoders != nil + && [IcachedEncoders indexOfObjectIdenticalTo: c] == NSNotFound) { - [_cachedEncoders addObject: c]; + [IcachedEncoders addObject: c]; } [c dispatch]; /* Tell NSPortCoder to release the connection. */ RELEASE(c); - M_UNLOCK(_refGate); + M_UNLOCK(IrefGate); } - (NSPortCoder*) _makeInRmc: (NSMutableArray*)components @@ -3115,23 +3213,23 @@ static void callEncoder (DOContext *ctxt) NSPortCoder *coder; unsigned count; - NSParameterAssert(_isValid); + NSParameterAssert(IisValid); - M_LOCK(_refGate); - if (cacheCoders == YES && _cachedDecoders != nil - && (count = [_cachedDecoders count]) > 0) + M_LOCK(IrefGate); + if (cacheCoders == YES && IcachedDecoders != nil + && (count = [IcachedDecoders count]) > 0) { - coder = RETAIN([_cachedDecoders objectAtIndex: --count]); - [_cachedDecoders removeObjectAtIndex: count]; + coder = RETAIN([IcachedDecoders objectAtIndex: --count]); + [IcachedDecoders removeObjectAtIndex: count]; } else { coder = [recvCoderClass allocWithZone: NSDefaultMallocZone()]; } - M_UNLOCK(_refGate); + M_UNLOCK(IrefGate); - coder = [coder initWithReceivePort: _receivePort - sendPort: _sendPort + coder = [coder initWithReceivePort: IreceivePort + sendPort:IsendPort components: components]; return coder; } @@ -3142,7 +3240,7 @@ static void callEncoder (DOContext *ctxt) * sno Is the seqence number to encode into the coder. * ret If non-null, generate a new sequence number and return it * here. Ignore the sequence number passed in sno. - * rep If this flag is YES, add a placeholder to the _replyMap + * rep If this flag is YES, add a placeholder to the IreplyMap * so we handle an incoming reply for this sequence number. */ - (NSPortCoder*) _makeOutRmc: (int)sno generate: (int*)ret reply: (BOOL)rep @@ -3150,15 +3248,15 @@ static void callEncoder (DOContext *ctxt) NSPortCoder *coder; unsigned count; - NSParameterAssert(_isValid); + NSParameterAssert(IisValid); - M_LOCK(_refGate); + M_LOCK(IrefGate); /* * Generate a new sequence number if required. */ if (ret != 0) { - sno = _messageCount++; + sno = ImessageCount++; *ret = sno; } /* @@ -3166,25 +3264,25 @@ static void callEncoder (DOContext *ctxt) */ if (rep == YES) { - GSIMapAddPair(_replyMap, (GSIMapKey)sno, (GSIMapVal)dummyObject); + GSIMapAddPair(IreplyMap, (GSIMapKey)sno, (GSIMapVal)dummyObject); } /* * Locate or create an rmc */ - if (cacheCoders == YES && _cachedEncoders != nil - && (count = [_cachedEncoders count]) > 0) + if (cacheCoders == YES && IcachedEncoders != nil + && (count = [IcachedEncoders count]) > 0) { - coder = RETAIN([_cachedEncoders objectAtIndex: --count]); - [_cachedEncoders removeObjectAtIndex: count]; + coder = RETAIN([IcachedEncoders objectAtIndex: --count]); + [IcachedEncoders removeObjectAtIndex: count]; } else { coder = [sendCoderClass allocWithZone: NSDefaultMallocZone()]; } - M_UNLOCK(_refGate); + M_UNLOCK(IrefGate); - coder = [coder initWithReceivePort: _receivePort - sendPort: _sendPort + coder = [coder initWithReceivePort: IreceivePort + sendPort:IsendPort components: nil]; [coder encodeValueOfObjCType: @encode(int) at: &sno]; NSDebugMLLog(@"NSConnection", @@ -3199,7 +3297,7 @@ static void callEncoder (DOContext *ctxt) BOOL raiseException = NO; NSMutableArray *components = [c _components]; - if (_authenticateOut == YES + if (IauthenticateOut == YES && (msgid == METHOD_REQUEST || msgid == METHOD_REPLY)) { NSData *d; @@ -3237,32 +3335,32 @@ static void callEncoder (DOContext *ctxt) NSDebugMLLog(@"NSConnection", @"Sending %@ on %@", stringFromMsgType(msgid), self); - limit = [dateClass dateWithTimeIntervalSinceNow: _requestTimeout]; - sent = [_sendPort sendBeforeDate: limit + limit = [dateClass dateWithTimeIntervalSinceNow: IrequestTimeout]; + sent = [IsendPort sendBeforeDate: limit msgid: msgid components: components - from: _receivePort - reserved: [_sendPort reservedSpaceLength]]; + from: IreceivePort + reserved: [IsendPort reservedSpaceLength]]; - M_LOCK(_refGate); + M_LOCK(IrefGate); /* * We replace the coder we have just used in the cache, and tell it not to * retain this connection any more. */ - if (cacheCoders == YES && _cachedEncoders != nil) + if (cacheCoders == YES && IcachedEncoders != nil) { - [_cachedEncoders addObject: c]; + [IcachedEncoders addObject: c]; } [c dispatch]; /* Tell NSPortCoder to release the connection. */ RELEASE(c); - M_UNLOCK(_refGate); + M_UNLOCK(IrefGate); if (sent == NO) { NSString *text = stringFromMsgType(msgid); - if ([_sendPort isValid] == NO) + if ([IsendPort isValid] == NO) { text = [text stringByAppendingFormat: @" - port was invalidated"]; } @@ -3280,10 +3378,10 @@ static void callEncoder (DOContext *ctxt) switch (msgid) { case METHOD_REQUEST: - _reqOutCount++; /* Sent a request. */ + IreqOutCount++; /* Sent a request. */ break; case METHOD_REPLY: - _repOutCount++; /* Sent back a reply. */ + IrepOutCount++; /* Sent back a reply. */ break; default: break; @@ -3301,8 +3399,8 @@ static void callEncoder (DOContext *ctxt) unsigned target; GSIMapNode node; - M_LOCK(_proxiesGate); - NSParameterAssert (_isValid); + M_LOCK(IrefGate); + NSParameterAssert (IisValid); object = ((ProxyStruct*)anObj)->_object; target = ((ProxyStruct*)anObj)->_handle; @@ -3316,22 +3414,22 @@ static void callEncoder (DOContext *ctxt) } /* - * Record the value in the _localObjects map, retaining it. + * Record the value in the IlocalObjects map, retaining it. */ - node = GSIMapNodeForKey(_localObjects, (GSIMapKey)object); + node = GSIMapNodeForKey(IlocalObjects, (GSIMapKey)object); NSAssert(node == 0, NSInternalInconsistencyException); - node = GSIMapNodeForKey(_localTargets, (GSIMapKey)target); + node = GSIMapNodeForKey(IlocalTargets, (GSIMapKey)target); NSAssert(node == 0, NSInternalInconsistencyException); IF_NO_GC([anObj retain];) - GSIMapAddPair(_localObjects, (GSIMapKey)object, (GSIMapVal)((id)anObj)); - GSIMapAddPair(_localTargets, (GSIMapKey)target, (GSIMapVal)((id)anObj)); + GSIMapAddPair(IlocalObjects, (GSIMapKey)object, (GSIMapVal)((id)anObj)); + GSIMapAddPair(IlocalTargets, (GSIMapKey)target, (GSIMapVal)((id)anObj)); if (debug_connection > 2) NSLog(@"add local object (0x%x) target (0x%x) " @"to connection (%@)", (uintptr_t)object, target, self); - M_UNLOCK(_proxiesGate); + M_UNLOCK(IrefGate); } - (NSDistantObject*) retainOrAddLocal: (NSDistantObject*)proxy @@ -3340,9 +3438,9 @@ static void callEncoder (DOContext *ctxt) GSIMapNode node; NSDistantObject *p; - /* Don't assert (_isValid); */ - M_LOCK(_proxiesGate); - node = GSIMapNodeForKey(_localObjects, (GSIMapKey)object); + /* Don't assert (IisValid); */ + M_LOCK(IrefGate); + node = GSIMapNodeForKey(IlocalObjects, (GSIMapKey)object); if (node == 0) { p = nil; @@ -3357,7 +3455,7 @@ static void callEncoder (DOContext *ctxt) p = proxy; [self addLocalObject: p]; } - M_UNLOCK(_proxiesGate); + M_UNLOCK(IrefGate); return p; } @@ -3368,9 +3466,9 @@ static void callEncoder (DOContext *ctxt) unsigned val = 0; GSIMapNode node; - M_LOCK(_proxiesGate); + M_LOCK(IrefGate); anObj = ((ProxyStruct*)prox)->_object; - node = GSIMapNodeForKey(_localObjects, (GSIMapKey)anObj); + node = GSIMapNodeForKey(IlocalObjects, (GSIMapKey)anObj); /* * The NSDistantObject concerned may not belong to this connection, @@ -3411,21 +3509,21 @@ static void callEncoder (DOContext *ctxt) } /* - * Remove the proxy from _localObjects and release it. + * Remove the proxy from IlocalObjects and release it. */ - GSIMapRemoveKey(_localObjects, (GSIMapKey)anObj); + GSIMapRemoveKey(IlocalObjects, (GSIMapKey)anObj); RELEASE(prox); /* * Remove the target info too - no release required. */ - GSIMapRemoveKey(_localTargets, (GSIMapKey)target); + GSIMapRemoveKey(IlocalTargets, (GSIMapKey)target); if (debug_connection > 2) NSLog(@"removed local object (0x%x) target (0x%x) " @"from connection (%@) (ref %d)", (uintptr_t)anObj, target, self, val); } - M_UNLOCK(_proxiesGate); + M_UNLOCK(IrefGate); } - (void) _release_target: (unsigned)target count: (unsigned)number @@ -3437,7 +3535,7 @@ static void callEncoder (DOContext *ctxt) * for the targets in the specified list since we don't have * proxies for them any more. */ - if (_receivePort != nil && _isValid == YES && number > 0) + if (IreceivePort != nil && IisValid == YES && number > 0) { id op; unsigned i; @@ -3471,13 +3569,13 @@ static void callEncoder (DOContext *ctxt) NSDistantObject *proxy = nil; GSIMapNode node; - M_LOCK(_proxiesGate); + M_LOCK(IrefGate); /* * Try a quick lookup to see if the target references a local object * belonging to the receiver ... usually it should. */ - node = GSIMapNodeForKey(_localTargets, (GSIMapKey)target); + node = GSIMapNodeForKey(IlocalTargets, (GSIMapKey)target); if (node != 0) { proxy = node->value.obj; @@ -3526,8 +3624,9 @@ static void callEncoder (DOContext *ctxt) { if (c != self && [c isValid] == YES) { - M_LOCK(c->_proxiesGate); - node = GSIMapNodeForKey(c->_localTargets, (GSIMapKey)target); + M_LOCK(GSIVar(c, _refGate)); + node = GSIMapNodeForKey(GSIVar(c, _localTargets), + (GSIMapKey)target); if (node != 0) { id local; @@ -3549,19 +3648,19 @@ static void callEncoder (DOContext *ctxt) proxy = [NSDistantObject proxyWithLocal: local connection: self]; nTarget = ((ProxyStruct*)proxy)->_handle; - GSIMapRemoveKey(_localTargets, (GSIMapKey)nTarget); + GSIMapRemoveKey(IlocalTargets, (GSIMapKey)nTarget); ((ProxyStruct*)proxy)->_handle = target; - GSIMapAddPair(_localTargets, (GSIMapKey)target, + GSIMapAddPair(IlocalTargets, (GSIMapKey)target, (GSIMapVal)((id)proxy)); } - M_UNLOCK(c->_proxiesGate); + M_UNLOCK(GSIVar(c, _refGate)); } } NSEndHashTableEnumeration(&enumerator); M_UNLOCK(connection_table_gate); } - M_UNLOCK(_proxiesGate); + M_UNLOCK(IrefGate); if (proxy == nil) { @@ -3573,9 +3672,9 @@ static void callEncoder (DOContext *ctxt) - (void) vendLocal: (NSDistantObject*)aProxy { - M_LOCK(_proxiesGate); + M_LOCK(IrefGate); ((ProxyStruct*)aProxy)->_counter++; - M_UNLOCK(_proxiesGate); + M_UNLOCK(IrefGate); } - (void) acquireProxyForTarget: (unsigned)target @@ -3583,9 +3682,9 @@ static void callEncoder (DOContext *ctxt) NSDistantObject *found; GSIMapNode node; - /* Don't assert (_isValid); */ - M_LOCK(_proxiesGate); - node = GSIMapNodeForKey(_remoteProxies, (GSIMapKey)target); + /* Don't assert (IisValid); */ + M_LOCK(IrefGate); + node = GSIMapNodeForKey(IremoteProxies, (GSIMapKey)target); if (node == 0) { found = nil; @@ -3594,7 +3693,7 @@ static void callEncoder (DOContext *ctxt) { found = node->value.obj; } - M_UNLOCK(_proxiesGate); + M_UNLOCK(IrefGate); if (found == nil) { NS_DURING @@ -3603,7 +3702,7 @@ static void callEncoder (DOContext *ctxt) * Tell the remote app that it must retain the local object * for the target on this connection. */ - if (_receivePort && _isValid) + if (IreceivePort && IisValid) { NSPortCoder *op; id ip; @@ -3638,15 +3737,15 @@ static void callEncoder (DOContext *ctxt) - (void) removeProxy: (NSDistantObject*)aProxy { - M_LOCK(_proxiesGate); - if (_isValid == YES) + M_LOCK(IrefGate); + if (IisValid == YES) { unsigned target; unsigned count = 1; GSIMapNode node; target = ((ProxyStruct*)aProxy)->_handle; - node = GSIMapNodeForKey(_remoteProxies, (GSIMapKey)target); + node = GSIMapNodeForKey(IremoteProxies, (GSIMapKey)target); /* * Only remove if the proxy for the target is the same as the @@ -3655,7 +3754,7 @@ static void callEncoder (DOContext *ctxt) if (node != 0 && node->value.obj == aProxy) { count = ((ProxyStruct*)aProxy)->_counter; - GSIMapRemoveKey(_remoteProxies, (GSIMapKey)target); + GSIMapRemoveKey(IremoteProxies, (GSIMapKey)target); /* * Tell the remote application that we have removed our proxy and * it can release it's local object. @@ -3663,7 +3762,7 @@ static void callEncoder (DOContext *ctxt) [self _release_target: target count: count]; } } - M_UNLOCK(_proxiesGate); + M_UNLOCK(IrefGate); } @@ -3688,14 +3787,14 @@ static void callEncoder (DOContext *ctxt) NSDistantObject *p; GSIMapNode node; - /* Don't assert (_isValid); */ + /* Don't assert (IisValid); */ NSParameterAssert(aTarget > 0); NSParameterAssert(aProxy==nil || aProxy->isa == distantObjectClass); NSParameterAssert(aProxy==nil || [aProxy connectionForProxy] == self); NSParameterAssert(aProxy==nil || aTarget == ((ProxyStruct*)aProxy)->_handle); - M_LOCK(_proxiesGate); - node = GSIMapNodeForKey(_remoteProxies, (GSIMapKey)aTarget); + M_LOCK(IrefGate); + node = GSIMapNodeForKey(IremoteProxies, (GSIMapKey)aTarget); if (node == 0) { p = nil; @@ -3708,7 +3807,7 @@ static void callEncoder (DOContext *ctxt) if (p == nil && aProxy != nil) { p = aProxy; - GSIMapAddPair(_remoteProxies, (GSIMapKey)aTarget, (GSIMapVal)((id)p)); + GSIMapAddPair(IremoteProxies, (GSIMapKey)aTarget, (GSIMapVal)((id)p)); } /* * Whether this is a new proxy or an existing proxy, this method is @@ -3720,7 +3819,7 @@ static void callEncoder (DOContext *ctxt) { ((ProxyStruct*)p)->_counter++; } - M_UNLOCK(_proxiesGate); + M_UNLOCK(IrefGate); return p; } @@ -3729,9 +3828,9 @@ static void callEncoder (DOContext *ctxt) NSDistantObject *ret; GSIMapNode node; - /* Don't assert (_isValid); */ - M_LOCK(_proxiesGate); - node = GSIMapNodeForKey(_localObjects, (GSIMapKey)anObj); + /* Don't assert (IisValid); */ + M_LOCK(IrefGate); + node = GSIMapNodeForKey(IlocalObjects, (GSIMapKey)anObj); if (node == 0) { ret = nil; @@ -3740,7 +3839,7 @@ static void callEncoder (DOContext *ctxt) { ret = node->value.obj; } - M_UNLOCK(_proxiesGate); + M_UNLOCK(IrefGate); return ret; } @@ -3749,9 +3848,9 @@ static void callEncoder (DOContext *ctxt) NSDistantObject *ret; GSIMapNode node; - /* Don't assert (_isValid); */ - M_LOCK(_proxiesGate); - node = GSIMapNodeForKey(_localTargets, (GSIMapKey)target); + /* Don't assert (IisValid); */ + M_LOCK(IrefGate); + node = GSIMapNodeForKey(IlocalTargets, (GSIMapKey)target); if (node == 0) { ret = nil; @@ -3760,7 +3859,7 @@ static void callEncoder (DOContext *ctxt) { ret = node->value.obj; } - M_UNLOCK(_proxiesGate); + M_UNLOCK(IrefGate); return ret; } @@ -3783,7 +3882,7 @@ static void callEncoder (DOContext *ctxt) */ - (void) _portIsInvalid: (NSNotification*)notification { - if (_isValid) + if (IisValid) { id port = [notification object]; @@ -3797,7 +3896,7 @@ static void callEncoder (DOContext *ctxt) except from our own ports; this is how we registered ourselves with the NSNotificationCenter in +newForInPort: outPort: ancestorConnection. */ - NSParameterAssert (port == _receivePort || port == _sendPort); + NSParameterAssert (port == IreceivePort || port == IsendPort); [self invalidate]; } diff --git a/Source/NSOperation.m b/Source/NSOperation.m index b00c70bfa..29b021667 100644 --- a/Source/NSOperation.m +++ b/Source/NSOperation.m @@ -144,7 +144,7 @@ GS_END_INTERNAL(NSOperation) [internal->dependencies removeObject: op]; } -- (NSArray *)dependencies +- (NSArray *) dependencies { return [NSArray arrayWithArray: internal->dependencies]; } @@ -233,7 +233,7 @@ GS_END_INTERNAL(NSOperationQueue) NSEnumerator *en = [internal->operations objectEnumerator]; id o = nil; - while ((o = [en nextObject]) != nil ) + while ((o = [en nextObject]) != nil) { [o cancel]; }