mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +00:00
tweaks to use new GC API
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@28051 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
38980826a4
commit
3a0afe2e58
8 changed files with 43 additions and 17 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
|||
2009-03-08 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/GSSocketStream.m:
|
||||
* Source/GSStream.m:
|
||||
* Source/NSConnection.m:
|
||||
* Source/NSKeyedArchiver.m:
|
||||
* Source/NSKeyedUnarchiver.m:
|
||||
* Source/NSObject.m:
|
||||
* Source/NSPort.m:
|
||||
* Source/NSXMLParser.m:
|
||||
GC tweaks to use new API.
|
||||
|
||||
2009-03-06 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSObject.m: Remove unused code for holding reference counts
|
||||
|
|
|
@ -1266,7 +1266,7 @@ setNonBlocking(SOCKET fd)
|
|||
DESTROY(_handler);
|
||||
if (_address != 0)
|
||||
{
|
||||
NSZoneFree(NSDefaultMallocZone(), _address);
|
||||
NSZoneFree(0, _address);
|
||||
}
|
||||
[super dealloc];
|
||||
}
|
||||
|
@ -1517,13 +1517,13 @@ setNonBlocking(SOCKET fd)
|
|||
if (_address != 0
|
||||
&& GSPrivateSockaddrLength(_address) != GSPrivateSockaddrLength(address))
|
||||
{
|
||||
NSZoneFree(NSDefaultMallocZone(), _address);
|
||||
NSZoneFree(0, _address);
|
||||
_address = 0;
|
||||
}
|
||||
if (_address == 0)
|
||||
{
|
||||
_address = (struct sockaddr*)
|
||||
NSZoneMalloc(NSDefaultMallocZone(), GSPrivateSockaddrLength(address));
|
||||
NSAllocateCollectable(GSPrivateSockaddrLength(address), 0);
|
||||
}
|
||||
memcpy(_address, address, GSPrivateSockaddrLength(address));
|
||||
}
|
||||
|
|
|
@ -145,7 +145,7 @@ static RunLoopEventType typeForStream(NSStream *aStream)
|
|||
|
||||
+ (void) initialize
|
||||
{
|
||||
class_ivar_set_gcinvisible (self, "delegate", YES);
|
||||
GSMakeWeakPointer(self, "delegate");
|
||||
}
|
||||
|
||||
- (void) close
|
||||
|
@ -162,13 +162,19 @@ static RunLoopEventType typeForStream(NSStream *aStream)
|
|||
_delegateValid = NO;
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
- (void) finalize
|
||||
{
|
||||
if (_currentStatus != NSStreamStatusNotOpen
|
||||
&& _currentStatus != NSStreamStatusClosed)
|
||||
{
|
||||
[self close];
|
||||
}
|
||||
GSAssignZeroingWeakPointer((void**)&_delegate, (void*)0);
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
[self finalize];
|
||||
if (_loops != 0)
|
||||
{
|
||||
NSFreeMapTable(_loops);
|
||||
|
@ -279,17 +285,25 @@ static RunLoopEventType typeForStream(NSStream *aStream)
|
|||
|| [self streamStatus] == NSStreamStatusError)
|
||||
{
|
||||
_delegateValid = NO;
|
||||
_delegate = nil;
|
||||
GSAssignZeroingWeakPointer((void**)&_delegate, (void*)0);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (delegate)
|
||||
if (delegate == nil)
|
||||
{
|
||||
_delegate = self;
|
||||
}
|
||||
if (delegate == self)
|
||||
{
|
||||
if (_delegate != nil && _delegate != self)
|
||||
{
|
||||
GSAssignZeroingWeakPointer((void**)&_delegate, (void*)0);
|
||||
}
|
||||
_delegate = delegate;
|
||||
}
|
||||
else
|
||||
{
|
||||
_delegate = self;
|
||||
GSAssignZeroingWeakPointer((void**)&_delegate, (void*)delegate);
|
||||
}
|
||||
/* We don't want to send any events the the delegate after the
|
||||
* stream has been closed.
|
||||
|
@ -636,7 +650,7 @@ static RunLoopEventType typeForStream(NSStream *aStream)
|
|||
if (self == [GSInputStream class])
|
||||
{
|
||||
GSObjCAddClassBehavior(self, [GSStream class]);
|
||||
class_ivar_set_gcinvisible (self, "delegate", YES);
|
||||
GSMakeWeakPointer(self, "delegate");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -669,7 +683,7 @@ static RunLoopEventType typeForStream(NSStream *aStream)
|
|||
if (self == [GSOutputStream class])
|
||||
{
|
||||
GSObjCAddClassBehavior(self, [GSStream class]);
|
||||
class_ivar_set_gcinvisible (self, "delegate", YES);
|
||||
GSMakeWeakPointer(self, "delegate");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -943,7 +957,7 @@ static RunLoopEventType typeForStream(NSStream *aStream)
|
|||
|
||||
+ (void) initialize
|
||||
{
|
||||
class_ivar_set_gcinvisible (self, "delegate", YES);
|
||||
GSMakeWeakPointer(self, "delegate");
|
||||
}
|
||||
|
||||
+ (id) serverStreamToAddr: (NSString*)addr port: (NSInteger)port
|
||||
|
|
|
@ -545,7 +545,7 @@ static NSLock *cached_proxies_gate = nil;
|
|||
{
|
||||
NSNotificationCenter *nc;
|
||||
|
||||
class_ivar_set_gcinvisible (self, "delegate", YES);
|
||||
GSMakeWeakPointer(self, "delegate");
|
||||
connectionClass = self;
|
||||
dateClass = [NSDate class];
|
||||
distantObjectClass = [NSDistantObject class];
|
||||
|
|
|
@ -471,7 +471,7 @@ static NSDictionary *makeReference(unsigned ref)
|
|||
|
||||
+ (void) initialize
|
||||
{
|
||||
class_ivar_set_gcinvisible (self, "delegate", YES);
|
||||
GSMakeWeakPointer(self, "delegate");
|
||||
|
||||
if (globalClassMap == 0)
|
||||
{
|
||||
|
|
|
@ -274,7 +274,7 @@ static NSMapTable globalClassMap = 0;
|
|||
|
||||
+ (void) initialize
|
||||
{
|
||||
class_ivar_set_gcinvisible (self, "delegate", YES);
|
||||
GSMakeWeakPointer(self, "delegate");
|
||||
|
||||
if (globalClassMap == 0)
|
||||
{
|
||||
|
|
|
@ -81,7 +81,7 @@ static Class NSPort_concrete_class;
|
|||
{
|
||||
NSUserDefaults *defs;
|
||||
|
||||
class_ivar_set_gcinvisible (self, "delegate", YES);
|
||||
GSMakeWeakPointer(self, "delegate");
|
||||
|
||||
NSPort_abstract_class = self;
|
||||
NSPort_concrete_class = [NSMessagePort class];
|
||||
|
|
|
@ -68,8 +68,8 @@ static NSNull *null = nil;
|
|||
|
||||
+ (void) initialize
|
||||
{
|
||||
class_ivar_set_gcinvisible (self, "_delegate", YES);
|
||||
class_ivar_set_gcinvisible (self, "_owner", YES);
|
||||
GSMakeWeakPointer(self, "_delegate");
|
||||
GSMakeWeakPointer(self, "_owner");
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
|
|
Loading…
Reference in a new issue