fixups for libobjc2

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29753 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2010-02-25 18:49:31 +00:00
parent 145a5670bf
commit 14b91c9052
67 changed files with 328 additions and 253 deletions

View file

@ -1,3 +1,77 @@
2010-02-25 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSIndexPath.m:
* Source/NSTimeZone.m:
* Source/NSURLCredential.m:
* Source/GSSocketStream.m:
* Source/NSURLHandle.m:
* Source/NSTimer.m:
* Source/NSScanner.m:
* Source/NSDistributedNotificationCenter.m:
* Source/NSSocketPort.m:
* Source/NSAttributedString.m:
* Source/NSRunLoop.m:
* Source/NSMethodSignature.m:
* Source/GSRunLoopWatcher.m:
* Source/GSArray.m:
* Source/GSFFCallInvocation.m:
* Source/NSKeyValueMutableSet.m:
* Source/GSStream.m:
* Source/NSKeyedArchiver.m:
* Source/unix/NSStream.m:
* Source/NSKeyedUnarchiver.m:
* Source/NSDistributedLock.m:
* Source/NSKeyValueObserving.m:
* Source/GSHTTPURLHandle.m:
* Source/NSURLCredentialStorage.m:
* Source/NSPort.m:
* Source/GSFFIInvocation.m:
* Source/NSMessagePort.m:
* Source/GSDictionary.m:
* Source/win32/GSFileHandle.m:
* Source/win32/NSMessagePort.m:
* Source/win32/NSStream.m:
* Source/GSCountedSet.m:
* Source/NSUnarchiver.m:
* Source/NSInvocation.m:
* Source/NSURLProtocol.m:
* Source/GSAttributedString.m:
* Source/NSKeyValueMutableArray.m:
* Source/NSException.m:
* Source/NSCopyObject.m:
* Source/NSURL.m:
* Source/NSObject.m:
* Source/NSString.m:
* Source/Additions/NSFileHandle+GNUstepBase.m:
* Source/Additions/GCDictionary.m:
* Source/Additions/GCArray.m:
* Source/Additions/GSXML.m:
* Source/Additions/GSInsensitiveDictionary.m:
* Source/Additions/GSLock.m:
* Source/GSSet.m:
* Source/NSNotification.m:
* Source/NSNumber.m:
* Source/GSString.m:
* Source/NSConnection.m:
* Source/NSAutoreleasePool.m:
* Source/NSThread.m:
* Source/NSData.m:
* Source/NSHost.m:
* Source/NSDate.m:
* Source/GSValue.m:
* Source/NSValue.m:
* Source/NSCountedSet.m:
* Source/GSFileHandle.m:
* Source/NSLock.m:
* Source/NSSet.m:
* Source/NSCharacterSet.m:
* SSL/GSSSLHandle.m:
Always DESTROY(self) rather than RELEASE(self) so that the pointer
is nil if/when another method is called from the method where self
was potentially deallocated. This is so that the libobjc2 runtime
doesn't try dereferencing self when it points to a deallocated
object.
2010-02-25 Richard Frith-Macdonald <rfm@gnu.org>
* configure.ac:

View file

@ -277,7 +277,7 @@ static BOOL permitSSLv2 = NO;
[loop runUntilDate: [NSDate dateWithTimeIntervalSinceNow: 0.01]];
if (ssl == 0)
{
RELEASE(self);
DESTROY(self);
return NO;
}
ret = SSL_accept(ssl);
@ -306,7 +306,7 @@ static BOOL permitSSLv2 = NO;
{
RELEASE(when);
RELEASE(final);
RELEASE(self);
DESTROY(self);
return NO;
}
ret = SSL_accept(ssl);
@ -331,12 +331,12 @@ static BOOL permitSSLv2 = NO;
NSWarnLog(@"unable to accept SSL connection from %@:%@ - %@",
address, service, sslError(err));
}
RELEASE(self);
DESTROY(self);
return NO;
}
}
connected = YES;
RELEASE(self);
DESTROY(self);
return YES;
}
@ -383,7 +383,7 @@ static BOOL permitSSLv2 = NO;
[loop runUntilDate: [NSDate dateWithTimeIntervalSinceNow: 0.01]];
if (ssl == 0)
{
RELEASE(self);
DESTROY(self);
return NO;
}
ret = SSL_connect(ssl);
@ -412,7 +412,7 @@ static BOOL permitSSLv2 = NO;
{
RELEASE(when);
RELEASE(final);
RELEASE(self);
DESTROY(self);
return NO;
}
ret = SSL_connect(ssl);
@ -437,12 +437,12 @@ static BOOL permitSSLv2 = NO;
NSLog(@"unable to make SSL connection to %@:%@ - %@",
address, service, sslError(err));
}
RELEASE(self);
DESTROY(self);
return NO;
}
}
connected = YES;
RELEASE(self);
DESTROY(self);
return YES;
}

View file

@ -157,7 +157,7 @@ static Class gcClass = 0;
_contents[_count] = RETAIN(objects[_count]);
if (_contents[_count] == nil)
{
[self release];
DESTROY(self);
[NSException raise: NSInvalidArgumentException
format: @"Nil object to be added in array"];
}
@ -309,7 +309,7 @@ static Class gcClass = 0;
_contents[_count] = RETAIN(objects[_count]);
if (_contents[_count] == nil)
{
[self release];
DESTROY(self);
[NSException raise: NSInvalidArgumentException
format: @"Nil object to be added in array"];
}

View file

@ -279,7 +279,7 @@ static Class gcClass = 0;
if (!keys[count] || !objects[count])
{
[self release];
DESTROY(self);
[NSException raise: NSInvalidArgumentException
format: @"Nil object added in dictionary"];
}

View file

@ -92,7 +92,7 @@ static SEL objSel;
return RETAIN(self);
}
- (unsigned) count
- (NSUInteger) count
{
return map.nodeCount;
}
@ -111,13 +111,13 @@ static SEL objSel;
}
else
{
unsigned count = map.nodeCount;
NSUInteger count = map.nodeCount;
SEL sel = @selector(encodeObject:);
IMP imp = [aCoder methodForSelector: sel];
GSIMapEnumerator_t enumerator = GSIMapEnumeratorForMap(&map);
GSIMapNode node = GSIMapEnumeratorNextNode(&enumerator);
[aCoder encodeValueOfObjCType: @encode(unsigned) at: &count];
[aCoder encodeValueOfObjCType: @encode(NSUInteger) at: &count];
while (node != 0)
{
(*imp)(aCoder, sel, node->key.obj);
@ -128,7 +128,7 @@ static SEL objSel;
}
}
- (unsigned) hash
- (NSUInteger) hash
{
return map.nodeCount;
}
@ -146,14 +146,14 @@ static SEL objSel;
}
else
{
unsigned count;
NSUInteger count;
id key;
id value;
SEL sel = @selector(decodeValueOfObjCType:at:);
IMP imp = [aCoder methodForSelector: sel];
const char *type = @encode(id);
[aCoder decodeValueOfObjCType: @encode(unsigned)
[aCoder decodeValueOfObjCType: @encode(NSUInteger)
at: &count];
GSIMapInitWithZoneAndCapacity(&map, GSObjCZone(self), count);
@ -168,9 +168,9 @@ static SEL objSel;
}
/* Designated initialiser */
- (id) initWithObjects: (id*)objs forKeys: (id*)keys count: (unsigned)c
- (id) initWithObjects: (id*)objs forKeys: (id*)keys count: (NSUInteger)c
{
unsigned int i;
NSUInteger i;
GSIMapInitWithZoneAndCapacity(&map, GSObjCZone(self), c);
for (i = 0; i < c; i++)
@ -179,13 +179,13 @@ static SEL objSel;
if (keys[i] == nil)
{
IF_NO_GC(AUTORELEASE(self));
DESTROY(self);
[NSException raise: NSInvalidArgumentException
format: @"Tried to init dictionary with nil key"];
}
if (objs[i] == nil)
{
IF_NO_GC(AUTORELEASE(self));
DESTROY(self);
[NSException raise: NSInvalidArgumentException
format: @"Tried to init dictionary with nil value"];
}
@ -212,7 +212,7 @@ static SEL objSel;
copyItems: (BOOL)shouldCopy
{
NSZone *z = GSObjCZone(self);
unsigned c = [other count];
NSUInteger c = [other count];
GSIMapInitWithZoneAndCapacity(&map, z, c);
if (c > 0)
@ -221,7 +221,7 @@ static SEL objSel;
IMP nxtObj = [e methodForSelector: nxtSel];
IMP otherObj = [other methodForSelector: objSel];
BOOL isProxy = [other isProxy];
unsigned i;
NSUInteger i;
for (i = 0; i < c; i++)
{
@ -242,7 +242,7 @@ static SEL objSel;
k = [k copyWithZone: z];
if (k == nil)
{
IF_NO_GC(AUTORELEASE(self));
DESTROY(self);
[NSException raise: NSInvalidArgumentException
format: @"Tried to init dictionary with nil key"];
}
@ -256,7 +256,7 @@ static SEL objSel;
}
if (o == nil)
{
IF_NO_GC(AUTORELEASE(self));
DESTROY(self);
[NSException raise: NSInvalidArgumentException
format: @"Tried to init dictionary with nil value"];
}
@ -278,7 +278,7 @@ static SEL objSel;
- (BOOL) isEqualToDictionary: (NSDictionary*)other
{
unsigned count;
NSUInteger count;
if (other == self)
{
@ -363,7 +363,7 @@ static SEL objSel;
}
/* Designated initialiser */
- (id) initWithCapacity: (unsigned)cap
- (id) initWithCapacity: (NSUInteger)cap
{
GSIMapInitWithZoneAndCapacity(&map, GSObjCZone(self), cap);
return self;

View file

@ -84,7 +84,7 @@
if ([NSThread isMultiThreaded] == YES)
{
RELEASE(self);
DESTROY(self);
self = [NSLock new];
}
else
@ -229,7 +229,7 @@
if ([NSThread isMultiThreaded] == YES)
{
RELEASE(self);
DESTROY(self);
self = [NSRecursiveLock new];
}
else

View file

@ -423,7 +423,7 @@ static NSMapTable *attrNames = 0;
- (id) init
{
NSLog(@"GSXMLDocument: calling -init is not legal");
RELEASE(self);
DESTROY(self);
return nil;
}
@ -641,7 +641,7 @@ static NSMapTable *nsNames = 0;
- (id) init
{
NSLog(@"GSXMLNamespace: calling -init is not legal");
RELEASE(self);
DESTROY(self);
return nil;
}
@ -1093,7 +1093,7 @@ static NSMapTable *nodeNames = 0;
- (id) init
{
NSLog(@"GSXMLNode: calling -init is not legal");
RELEASE(self);
DESTROY(self);
return nil;
}
@ -1980,13 +1980,13 @@ static NSString *endMarker = @"At end of incremental parse";
else
{
NSLog(@"Bad GSSAXHandler object passed to GSXMLParser initialiser");
RELEASE(self);
DESTROY(self);
return nil;
}
[saxHandler _setParser: self];
if ([self _initLibXML] == NO)
{
RELEASE(self);
DESTROY(self);
return nil;
}
return self;
@ -2009,7 +2009,7 @@ static NSString *endMarker = @"At end of incremental parse";
if (path == nil || [path isKindOfClass: NSString_class] == NO)
{
NSLog(@"Bad file path passed to initialize GSXMLParser");
RELEASE(self);
DESTROY(self);
return nil;
}
src = [path copy];
@ -2034,7 +2034,7 @@ static NSString *endMarker = @"At end of incremental parse";
if (url == nil || [url isKindOfClass: [NSURL class]] == NO)
{
NSLog(@"Bad NSURL passed to initialize GSXMLParser");
RELEASE(self);
DESTROY(self);
return nil;
}
src = [url copy];
@ -2059,7 +2059,7 @@ static NSString *endMarker = @"At end of incremental parse";
if (data == nil || [data isKindOfClass: [NSData class]] == NO)
{
NSLog(@"Bad NSData passed to initialize GSXMLParser");
RELEASE(self);
DESTROY(self);
return nil;
}
src = [data copy];
@ -3014,7 +3014,7 @@ fatalErrorFunction(void *ctx, const unsigned char *msg, ...)
if ([self _initLibXML] == NO)
{
NSLog(@"GSSAXHandler: out of memory\n");
RELEASE(self);
DESTROY(self);
return nil;
}
}
@ -3594,7 +3594,7 @@ fatalErrorFunction(void *ctx, const unsigned char *msg, ...)
@implementation GSXPathObject
- (id) init
{
RELEASE(self);
DESTROY(self);
return nil;
}
@ -4163,14 +4163,14 @@ static BOOL warned = NO; if (warned == NO) { warned = YES; NSLog(@"WARNING, use
{
NSLog(@"Not built with libxml ... %@ unusable in %@",
NSStringFromClass([self class]), NSStringFromSelector(_cmd));
RELEASE(self);
DESTROY(self);
return nil;
}
- (id) initWithCoder: (NSCoder*)aCoder
{
NSLog(@"Not built with libxml ... %@ unusable in %@",
NSStringFromClass([self class]), NSStringFromSelector(_cmd));
RELEASE(self);
DESTROY(self);
return nil;
}
@end

View file

@ -130,7 +130,7 @@ getAddr(NSString* name, NSString* svc, NSString* pcl, struct sockaddr_in *sin)
if (getAddr(a, s, p, &sin) == NO)
{
RELEASE(self);
DESTROY(self);
NSLog(@"bad address-service-protocol combination");
return nil;
}
@ -138,7 +138,7 @@ getAddr(NSString* name, NSString* svc, NSString* pcl, struct sockaddr_in *sin)
if ((net = socket(AF_INET, SOCK_STREAM, PF_UNSPEC)) < 0)
{
NSLog(@"unable to create socket - %@", [NSError _last]);
RELEASE(self);
DESTROY(self);
return nil;
}
@ -157,7 +157,7 @@ getAddr(NSString* name, NSString* svc, NSString* pcl, struct sockaddr_in *sin)
NSLog(@"unable to bind to port %s:%d - %@", inet_ntoa(sin.sin_addr),
NSSwapBigShortToHost(sin.sin_port), [NSError _last]);
(void) close(net);
RELEASE(self);
DESTROY(self);
return nil;
}
@ -165,7 +165,7 @@ getAddr(NSString* name, NSString* svc, NSString* pcl, struct sockaddr_in *sin)
{
NSLog(@"unable to listen on port - %@", [NSError _last]);
(void) close(net);
RELEASE(self);
DESTROY(self);
return nil;
}
@ -173,7 +173,7 @@ getAddr(NSString* name, NSString* svc, NSString* pcl, struct sockaddr_in *sin)
{
NSLog(@"unable to get socket name - %@", [NSError _last]);
(void) close(net);
RELEASE(self);
DESTROY(self);
return nil;
}

View file

@ -162,7 +162,7 @@ static Class GSInlineArrayClass;
#endif
if (_contents_array == 0)
{
RELEASE(self);
DESTROY(self);
return nil;
}
@ -171,7 +171,7 @@ static Class GSInlineArrayClass;
if ((_contents_array[i] = RETAIN(objects[i])) == nil)
{
_count = i;
RELEASE(self);
DESTROY(self);
[NSException raise: NSInvalidArgumentException
format: @"Tried to init array with nil to object"];
}
@ -422,7 +422,7 @@ static Class GSInlineArrayClass;
if ((_contents_array[i] = RETAIN(objects[i])) == nil)
{
_count = i;
RELEASE(self);
DESTROY(self);
[NSException raise: NSInvalidArgumentException
format: @"Tried to init array with nil object"];
}
@ -574,7 +574,7 @@ static Class GSInlineArrayClass;
if ((_contents_array[i] = RETAIN(objects[i])) == nil)
{
_count = i;
RELEASE(self);
DESTROY(self);
[NSException raise: NSInvalidArgumentException
format: @"Tried to init array with nil object"];
}
@ -1197,7 +1197,7 @@ static Class GSInlineArrayClass;
- (id) initWithCoder: (NSCoder*)aCoder
{
NSLog(@"Warning - decoding archive containing obsolete %@ object - please delete/replace this archive", NSStringFromClass([self class]));
RELEASE(self);
DESTROY(self);
self = (id)NSAllocateObject([GSArray class], 0, NSDefaultMallocZone());
self = [self initWithCoder: aCoder];
return self;
@ -1210,7 +1210,7 @@ static Class GSInlineArrayClass;
- (id) initWithCoder: (NSCoder*)aCoder
{
NSLog(@"Warning - decoding archive containing obsolete %@ object - please delete/replace this archive", NSStringFromClass([self class]));
RELEASE(self);
DESTROY(self);
self = (id)NSAllocateObject([GSMutableArray class], 0, NSDefaultMallocZone());
self = [self initWithCoder: aCoder];
return self;

View file

@ -912,7 +912,7 @@ SANITY();
- (id) initWithCoder: (NSCoder*)aCoder
{
NSLog(@"Warning - decoding archive containing obsolete %@ object - please delete/replace this archive", NSStringFromClass([self class]));
RELEASE(self);
DESTROY(self);
self = (id)NSAllocateObject([GSAttributedString class], 0, NSDefaultMallocZone());
self = [self initWithCoder: aCoder];
return self;
@ -925,7 +925,7 @@ SANITY();
- (id) initWithCoder: (NSCoder*)aCoder
{
NSLog(@"Warning - decoding archive containing obsolete %@ object - please delete/replace this archive", NSStringFromClass([self class]));
RELEASE(self);
DESTROY(self);
self = (id)NSAllocateObject([GSMutableAttributedString class], 0, NSDefaultMallocZone());
self = [self initWithCoder: aCoder];
return self;

View file

@ -242,7 +242,7 @@ static GC_descr nodeDesc; // Type descriptor for map node.
if (objs[i] == nil)
{
IF_NO_GC(AUTORELEASE(self));
DESTROY(self);
[NSException raise: NSInvalidArgumentException
format: @"Tried to init counted set with nil value"];
}

View file

@ -194,13 +194,13 @@ static SEL objSel;
if (keys[i] == nil)
{
IF_NO_GC(AUTORELEASE(self));
DESTROY(self);
[NSException raise: NSInvalidArgumentException
format: @"Tried to init dictionary with nil key"];
}
if (objs[i] == nil)
{
IF_NO_GC(AUTORELEASE(self));
DESTROY(self);
[NSException raise: NSInvalidArgumentException
format: @"Tried to init dictionary with nil value"];
}
@ -257,7 +257,7 @@ static SEL objSel;
k = [k copyWithZone: z];
if (k == nil)
{
IF_NO_GC(AUTORELEASE(self));
DESTROY(self);
[NSException raise: NSInvalidArgumentException
format: @"Tried to init dictionary with nil key"];
}
@ -271,7 +271,7 @@ static SEL objSel;
}
if (o == nil)
{
IF_NO_GC(AUTORELEASE(self));
DESTROY(self);
[NSException raise: NSInvalidArgumentException
format: @"Tried to init dictionary with nil value"];
}
@ -526,7 +526,7 @@ static SEL objSel;
- (id) initWithCoder: (NSCoder*)aCoder
{
NSLog(@"Warning - decoding archive containing obsolete %@ object - please delete/replace this archive", NSStringFromClass([self class]));
RELEASE(self);
DESTROY(self);
self = (id)NSAllocateObject([GSDictionary class], 0, NSDefaultMallocZone());
self = [self initWithCoder: aCoder];
return self;
@ -539,7 +539,7 @@ static SEL objSel;
- (id) initWithCoder: (NSCoder*)aCoder
{
NSLog(@"Warning - decoding archive containing obsolete %@ object - please delete/replace this archive", NSStringFromClass([self class]));
RELEASE(self);
DESTROY(self);
self = (id)NSAllocateObject([GSMutableDictionary class], 0, NSDefaultMallocZone());
self = [self initWithCoder: aCoder];
return self;

View file

@ -541,7 +541,7 @@ static IMP gs_objc_msg_forward (SEL sel)
{
if (aSignature == nil)
{
RELEASE(self);
DESTROY(self);
return nil;
}
_sig = RETAIN(aSignature);

View file

@ -311,7 +311,7 @@ static id gs_objc_proxy_lookup(id receiver, SEL op)
if (aSignature == nil)
{
RELEASE(self);
DESTROY(self);
return nil;
}
_sig = RETAIN(aSignature);

View file

@ -696,7 +696,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if (s == nil)
{
NSLog(@"bad argument - service is nil");
RELEASE(self);
DESTROY(self);
return nil;
}
@ -718,7 +718,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if (getAddr(lhost, p, @"tcp", &lsin) == NO)
{
NSLog(@"bad bind address specification");
RELEASE(self);
DESTROY(self);
return nil;
}
p = @"tcp";
@ -764,7 +764,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if (getAddr(a, s, p, &sin) == NO)
{
RELEASE(self);
DESTROY(self);
NSLog(@"bad address-service-protocol combination");
return nil;
}
@ -788,7 +788,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if (getAddr(shost, sport, p, &sin) == NO)
{
NSLog(@"bad SOCKS host-port combination");
RELEASE(self);
DESTROY(self);
return nil;
}
}
@ -796,7 +796,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if ((net = socket(AF_INET, SOCK_STREAM, PF_UNSPEC)) == -1)
{
NSLog(@"unable to create socket - %@", [NSError _last]);
RELEASE(self);
DESTROY(self);
return nil;
}
/*
@ -812,7 +812,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
NSLog(@"unable to bind to port %s:%d - %@", inet_ntoa(lsin.sin_addr),
GSSwapBigI16ToHost(sin.sin_port), [NSError _last]);
(void) close(net);
RELEASE(self);
DESTROY(self);
return nil;
}
}
@ -831,7 +831,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
NSLog(@"unable to make connection to %s:%d - %@",
inet_ntoa(sin.sin_addr),
GSSwapBigI16ToHost(sin.sin_port), [NSError _last]);
RELEASE(self);
DESTROY(self);
return nil;
}
}
@ -887,7 +887,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if (getAddr(a, s, p, &sin) == NO)
{
RELEASE(self);
DESTROY(self);
NSLog(@"bad address-service-protocol combination");
return nil;
}
@ -895,7 +895,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if ((net = socket(AF_INET, SOCK_STREAM, PF_UNSPEC)) == -1)
{
NSLog(@"unable to create socket - %@", [NSError _last]);
RELEASE(self);
DESTROY(self);
return nil;
}
@ -914,7 +914,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
NSLog(@"unable to bind to port %s:%d - %@", inet_ntoa(sin.sin_addr),
GSSwapBigI16ToHost(sin.sin_port), [NSError _last]);
(void) close(net);
RELEASE(self);
DESTROY(self);
return nil;
}
@ -922,7 +922,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
{
NSLog(@"unable to listen on port - %@", [NSError _last]);
(void) close(net);
RELEASE(self);
DESTROY(self);
return nil;
}
@ -930,7 +930,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
{
NSLog(@"unable to get socket name - %@", [NSError _last]);
(void) close(net);
RELEASE(self);
DESTROY(self);
return nil;
}
@ -953,7 +953,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if (d < 0)
{
RELEASE(self);
DESTROY(self);
return nil;
}
else
@ -975,7 +975,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if (d < 0)
{
RELEASE(self);
DESTROY(self);
return nil;
}
else
@ -997,7 +997,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if (d < 0)
{
RELEASE(self);
DESTROY(self);
return nil;
}
else
@ -1017,7 +1017,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if (fh_stderr != nil)
{
IF_NO_GC([fh_stderr retain];)
RELEASE(self);
DESTROY(self);
}
else
{
@ -1037,7 +1037,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if (fh_stdin != nil)
{
IF_NO_GC([fh_stdin retain];)
RELEASE(self);
DESTROY(self);
}
else
{
@ -1057,7 +1057,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if (fh_stdout != nil)
{
IF_NO_GC([fh_stdout retain];)
RELEASE(self);
DESTROY(self);
}
else
{

View file

@ -555,7 +555,7 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
[sock writeInBackgroundAndNotify: buf];
RELEASE(buf);
RELEASE(s);
RELEASE(self);
DESTROY(self);
}
- (void) bgdRead: (NSNotification*) not
@ -810,7 +810,7 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
}
}
}
RELEASE(self);
DESTROY(self);
}
- (void) bgdTunnelRead: (NSNotification*) not
@ -862,7 +862,7 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
}
}
RELEASE(p);
RELEASE(self);
DESTROY(self);
}
- (void) loadInBackground
@ -920,7 +920,7 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
[self endLoadInBackground];
[self backgroundLoadDidFailWithReason:
[NSString stringWithFormat: @"Failed to connect: %@", e]];
RELEASE(self);
DESTROY(self);
return;
}
@ -1002,7 +1002,7 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
{
[self endLoadInBackground];
[self backgroundLoadDidFailWithReason: @"Failed proxy tunneling"];
RELEASE(self);
DESTROY(self);
return;
}
}
@ -1018,7 +1018,7 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
[self endLoadInBackground];
[self backgroundLoadDidFailWithReason:
@"Failed to make ssl connect"];
RELEASE(self);
DESTROY(self);
return;
}
}
@ -1060,7 +1060,7 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
[self bgdApply: s];
RELEASE(s);
RELEASE(self);
DESTROY(self);
}
- (void) bgdWrite: (NSNotification*)notification
@ -1102,7 +1102,7 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
[self endLoadInBackground];
[self backgroundLoadDidFailWithReason:
[NSString stringWithFormat: @"Failed to write request: %@", e]];
RELEASE(self);
DESTROY(self);
return;
}
else
@ -1139,7 +1139,7 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
}
connectionState = reading;
}
RELEASE(self);
DESTROY(self);
}
/**

View file

@ -56,7 +56,7 @@
case ET_RPORT: type = aType; break;
case ET_TRIGGER: type = aType; break;
default:
RELEASE(self);
DESTROY(self);
[NSException raise: NSInvalidArgumentException
format: @"NSRunLoop - unknown event type"];
}
@ -68,7 +68,7 @@
if (![anObj respondsToSelector: @selector(receivedEvent:type:extra:forMode:)])
{
RELEASE(self);
DESTROY(self);
[NSException raise: NSInvalidArgumentException
format: @"RunLoop listener has no event handling method"];
}

View file

@ -263,7 +263,7 @@ static Class mutableSetClass;
if (objs[i] == nil)
{
IF_NO_GC(AUTORELEASE(self));
DESTROY(self);
[NSException raise: NSInvalidArgumentException
format: @"Tried to init set with nil value"];
}
@ -745,7 +745,7 @@ static Class mutableSetClass;
- (id) initWithCoder: (NSCoder*)aCoder
{
NSLog(@"Warning - decoding archive containing obsolete %@ object - please delete/replace this archive", NSStringFromClass([self class]));
RELEASE(self);
DESTROY(self);
self = (id)NSAllocateObject([GSSet class], 0, NSDefaultMallocZone());
self = [self initWithCoder: aCoder];
return self;
@ -758,7 +758,7 @@ static Class mutableSetClass;
- (id) initWithCoder: (NSCoder*)aCoder
{
NSLog(@"Warning - decoding archive containing obsolete %@ object - please delete/replace this archive", NSStringFromClass([self class]));
RELEASE(self);
DESTROY(self);
self = (id)NSAllocateObject([GSMutableSet class], 0, NSDefaultMallocZone());
self = [self initWithCoder: aCoder];
return self;

View file

@ -2644,7 +2644,7 @@ setNonBlocking(SOCKET fd)
#else
- (id) initToAddr: (NSString*)addr port: (NSInteger)port
{
RELEASE(self);
DESTROY(self);
return nil;
}
#endif
@ -2684,7 +2684,7 @@ setNonBlocking(SOCKET fd)
#else
- (id) initToAddr: (NSString*)addr port: (NSInteger)port
{
RELEASE(self);
DESTROY(self);
return nil;
}
#endif
@ -2750,7 +2750,7 @@ setNonBlocking(SOCKET fd)
#else
- (id) initToAddr: (NSString*)addr port: (NSInteger)port
{
RELEASE(self);
DESTROY(self);
return nil;
}
#endif

View file

@ -973,7 +973,7 @@ static RunLoopEventType typeForStream(NSStream *aStream)
- (id) initToAddr: (NSString*)addr port: (NSInteger)port
{
RELEASE(self);
DESTROY(self);
// try inet first, then inet6
self = [[GSInetServerStream alloc] initToAddr: addr port: port];
if (!self)
@ -983,7 +983,7 @@ static RunLoopEventType typeForStream(NSStream *aStream)
- (id) initToAddr: (NSString*)addr
{
RELEASE(self);
DESTROY(self);
return [[GSLocalServerStream alloc] initToAddr: addr];
}

View file

@ -2912,7 +2912,7 @@ transmute(GSStr self, NSString *aString)
NSString *c = NSStringFromClass([self class]);
NSString *s = NSStringFromSelector(_cmd);
RELEASE(self);
DESTROY(self);
[NSException raise: NSInternalInconsistencyException
format: @"[%@-%@] called on string already initialised", c, s];
return nil;
@ -3984,7 +3984,7 @@ NSAssert(_flags.owned == 1 && _zone != 0, NSInternalInconsistencyException);
{
if (encoding == NSASCIIStringEncoding)
{
RELEASE(self);
DESTROY(self);
if (shouldFree == YES)
{
NSZoneFree(NSZoneFromPointer(chars), chars);
@ -4032,7 +4032,7 @@ NSAssert(_flags.owned == 1 && _zone != 0, NSInternalInconsistencyException);
if (GSToUnicode(&u, &l, (unsigned char*)chars, length, encoding,
_zone, 0) == NO)
{
RELEASE(self);
DESTROY(self);
if (shouldFree == YES)
{
NSZoneFree(NSZoneFromPointer(chars), chars);

View file

@ -80,7 +80,7 @@ typeSize(const char* type)
if (!value || !type)
{
NSLog(@"Tried to create NSValue with NULL value or NULL type");
RELEASE(self);
DESTROY(self);
return nil;
}
@ -92,7 +92,7 @@ typeSize(const char* type)
if (size < 0)
{
NSLog(@"Tried to create NSValue with invalid Objective-C type");
RELEASE(self);
DESTROY(self);
return nil;
}
if (size > 0)

View file

@ -230,7 +230,7 @@ static Class GSMutableAttributedStringClass;
[m setAttributes: [attributes objectAtIndex: idx] range: r];
pos = NSMaxRange(r);
}
RELEASE(self);
DESTROY(self);
self = [m copy];
RELEASE(m);
}
@ -273,7 +273,7 @@ static Class GSMutableAttributedStringClass;
[m setAttributes: attrs range: r];
last = index;
}
RELEASE(self);
DESTROY(self);
self = [m copy];
RELEASE(m);
}

View file

@ -319,7 +319,7 @@ static IMP initImp;
}
(*imp)(collector, sel);
#else
[self release];
DESTROY(self);
#endif
}

View file

@ -853,7 +853,7 @@ static Class concreteMutableClass = nil;
obj = [concreteClass allocWithZone: [self zone]];
obj = [obj initWithBitmap: nil];
RELEASE(self);
DESTROY(self);
self = obj;
}
return self;
@ -1130,7 +1130,7 @@ static Class concreteMutableClass = nil;
obj = [concreteMutableClass allocWithZone: [self zone]];
obj = [obj initWithBitmap: nil];
RELEASE(self);
DESTROY(self);
self = obj;
}
return self;
@ -1144,7 +1144,7 @@ static Class concreteMutableClass = nil;
obj = [concreteMutableClass allocWithZone: [self zone]];
obj = [obj initWithBitmap: bitmap];
RELEASE(self);
DESTROY(self);
self = obj;
}
return self;

View file

@ -995,7 +995,7 @@ static NSLock *cached_proxies_gate = nil;
*/
if (conn != nil)
{
RELEASE(self);
DESTROY(self);
self = RETAIN(conn);
if (debug_connection > 2)
{
@ -1163,7 +1163,7 @@ static NSLock *cached_proxies_gate = nil;
if ([del connection: parent shouldMakeNewConnection: self] == NO)
{
M_UNLOCK(connection_table_gate);
RELEASE(self);
DESTROY(self);
return nil;
}
}
@ -1173,7 +1173,7 @@ static NSLock *cached_proxies_gate = nil;
if (![del makeNewConnection: self sender: parent])
{
M_UNLOCK(connection_table_gate);
RELEASE(self);
DESTROY(self);
return nil;
}
}
@ -1373,7 +1373,7 @@ static NSLock *cached_proxies_gate = nil;
[[IsendPort conversation: IreceivePort] invalidate];
}
RELEASE(self);
DESTROY(self);
}
/**

View file

@ -31,6 +31,6 @@ NSObject *NSCopyObject(NSObject *anObject, NSUInteger extraBytes, NSZone *zone)
{
id copy = NSAllocateObject(((id)anObject)->class_pointer, extraBytes, zone);
memcpy(copy, anObject,
((id)anObject)->class_pointer->instance_size + extraBytes);
class_getInstanceSize(object_getClass(anObject)) + extraBytes);
return copy;
}

View file

@ -119,7 +119,7 @@ static Class NSCountedSet_concrete_class;
if (c == NSCountedSet_abstract_class)
{
RELEASE(self);
DESTROY(self);
self = [NSCountedSet_concrete_class allocWithZone: NSDefaultMallocZone()];
return [self initWithCoder: aCoder];
}

View file

@ -640,7 +640,7 @@ failure:
{
#ifdef HAVE_MMAP
NSZone *z = GSObjCZone(self);
RELEASE(self);
DESTROY(self);
self = [NSDataMappedFile allocWithZone: z];
return [self initWithContentsOfMappedFile: path];
#else
@ -671,7 +671,7 @@ failure:
if ([data isKindOfClass: [NSData class]] == NO)
{
NSLog(@"-initWithData: passed a non-data object");
RELEASE(self);
DESTROY(self);
return nil;
}
return [self initWithBytes: [data bytes] length: [data length]];
@ -1917,7 +1917,7 @@ failure:
{
NSLog(@"[NSDataMalloc -initWithCoder:] unable to get %u bytes",
l);
RELEASE(self);
DESTROY(self);
return nil;
}
[aCoder decodeArrayOfObjCType: @encode(unsigned char) count: l at: b];
@ -3016,7 +3016,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
if (thePath == 0)
{
NSWarnMLog(@"Open (%@) attempt failed - bad path", path);
RELEASE(self);
DESTROY(self);
return nil;
}
@ -3028,7 +3028,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
if (fd < 0)
{
NSWarnMLog(@"unable to open %@ - %@", path, [NSError _last]);
RELEASE(self);
DESTROY(self);
return nil;
}
/* Find size of file to be mapped. */
@ -3037,7 +3037,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
{
NSWarnMLog(@"unable to seek to eof %@ - %@", path, [NSError _last]);
close(fd);
RELEASE(self);
DESTROY(self);
return nil;
}
/* Position at start of file. */
@ -3045,7 +3045,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
{
NSWarnMLog(@"unable to seek to sof %@ - %@", path, [NSError _last]);
close(fd);
RELEASE(self);
DESTROY(self);
return nil;
}
bytes = mmap(0, length, PROT_READ, MAP_SHARED, fd, 0);
@ -3053,7 +3053,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
{
NSWarnMLog(@"mapping failed for %s - %@", path, [NSError _last]);
close(fd);
RELEASE(self);
DESTROY(self);
self = [dataMalloc allocWithZone: NSDefaultMallocZone()];
self = [self initWithContentsOfFile: path];
}
@ -3110,7 +3110,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
{
NSLog(@"[-initWithBytes:length:] shared mem get failed for %u - %@",
bufferSize, [NSError _last]);
RELEASE(self);
DESTROY(self);
self = [dataMalloc allocWithZone: NSDefaultMallocZone()];
return [self initWithBytes: aBuffer length: bufferSize];
}
@ -3121,7 +3121,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
NSLog(@"[-initWithBytes:length:] shared mem attach failed for %u - %@",
bufferSize, [NSError _last]);
bytes = 0;
RELEASE(self);
DESTROY(self);
self = [dataMalloc allocWithZone: NSDefaultMallocZone()];
return [self initWithBytes: aBuffer length: bufferSize];
}
@ -3139,14 +3139,14 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
{
NSLog(@"[NSDataShared -initWithShmID:length:] shared memory "
@"control failed - %@", [NSError _last]);
RELEASE(self); /* Unable to access memory. */
DESTROY(self); /* Unable to access memory. */
return nil;
}
if (buf.shm_segsz < bufferSize)
{
NSLog(@"[NSDataShared -initWithShmID:length:] shared memory "
@"segment too small");
RELEASE(self); /* Memory segment too small. */
DESTROY(self); /* Memory segment too small. */
return nil;
}
bytes = shmat(shmid, 0, 0);
@ -3155,7 +3155,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
NSLog(@"[NSDataShared -initWithShmID:length:] shared memory "
@"attach failed - %@", [NSError _last]);
bytes = 0;
RELEASE(self); /* Unable to attach to memory. */
DESTROY(self); /* Unable to attach to memory. */
return nil;
}
length = bufferSize;
@ -3299,7 +3299,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
{
NSLog(@"[NSMutableDataMalloc -initWithCapacity:] out of memory "
@"for %u bytes - %@", size, [NSError _last]);
RELEASE(self);
DESTROY(self);
return nil;
}
}
@ -3843,7 +3843,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
{
NSLog(@"[NSMutableDataShared -initWithCapacity:] shared memory "
@"get failed for %u - %@", bufferSize, [NSError _last]);
RELEASE(self);
DESTROY(self);
self = [mutableDataMalloc allocWithZone: NSDefaultMallocZone()];
return [self initWithCapacity: bufferSize];
}
@ -3854,7 +3854,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
NSLog(@"[NSMutableDataShared -initWithCapacity:] shared memory "
@"attach failed for %u - %@", bufferSize, [NSError _last]);
bytes = 0;
RELEASE(self);
DESTROY(self);
self = [mutableDataMalloc allocWithZone: NSDefaultMallocZone()];
return [self initWithCapacity: bufferSize];
}
@ -3873,14 +3873,14 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
{
NSLog(@"[NSMutableDataShared -initWithShmID:length:] shared memory "
@"control failed - %@", [NSError _last]);
RELEASE(self); /* Unable to access memory. */
DESTROY(self); /* Unable to access memory. */
return nil;
}
if (buf.shm_segsz < bufferSize)
{
NSLog(@"[NSMutableDataShared -initWithShmID:length:] shared memory "
@"segment too small");
RELEASE(self); /* Memory segment too small. */
DESTROY(self); /* Memory segment too small. */
return nil;
}
bytes = shmat(shmid, 0, 0);
@ -3889,7 +3889,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
NSLog(@"[NSMutableDataShared -initWithShmID:length:] shared memory "
@"attach failed - %@", [NSError _last]);
bytes = 0;
RELEASE(self); /* Unable to attach to memory. */
DESTROY(self); /* Unable to attach to memory. */
return nil;
}
length = bufferSize;

View file

@ -1029,7 +1029,7 @@ otherTime(NSDate* other)
o = [concreteClass allocWithZone: NSDefaultMallocZone()];
o = [o initWithTimeIntervalSinceReferenceDate: interval];
}
RELEASE(self);
DESTROY(self);
return o;
}
@ -1054,7 +1054,7 @@ otherTime(NSDate* other)
d = [d initWithString: description];
if (d == nil)
{
RELEASE(self);
DESTROY(self);
return nil;
}
else
@ -1074,7 +1074,7 @@ otherTime(NSDate* other)
if (anotherDate == nil)
{
NSLog(@"initWithTimeInterval:sinceDate: given nil date");
RELEASE(self);
DESTROY(self);
return nil;
}
// Get the other date's time, add the secs and init thyself

View file

@ -132,27 +132,27 @@ static NSFileManager *mgr = nil;
if ([mgr fileExistsAtPath: lockDir isDirectory: &isDirectory] == NO)
{
NSLog(@"part of the path to the lock file '%@' is missing\n", aPath);
RELEASE(self);
DESTROY(self);
return nil;
}
if (isDirectory == NO)
{
NSLog(@"part of the path to the lock file '%@' is not a directory\n",
_lockPath);
RELEASE(self);
DESTROY(self);
return nil;
}
if ([mgr isWritableFileAtPath: lockDir] == NO)
{
NSLog(@"parent directory of lock file '%@' is not writable\n", _lockPath);
RELEASE(self);
DESTROY(self);
return nil;
}
if ([mgr isExecutableFileAtPath: lockDir] == NO)
{
NSLog(@"parent directory of lock file '%@' is not accessible\n",
_lockPath);
RELEASE(self);
DESTROY(self);
return nil;
}
return self;

View file

@ -244,7 +244,7 @@ static NSDistributedNotificationCenter *netCenter = nil;
*/
- (id) init
{
RELEASE(self);
DESTROY(self);
[NSException raise: NSInternalInconsistencyException
format: @"Should not call -init for NSDistributedNotificationCenter"];
return nil;

View file

@ -223,7 +223,7 @@ GSPrivateBaseAddress(void *addr, void **base)
- (id) init
{
[self release];
DESTROY(self);
return nil;
}
@ -312,7 +312,7 @@ GSPrivateBaseAddress(void *addr, void **base)
if ([fileName length] == 0)
{
//NSLog (@"GSBinaryFileInfo: No File");
[self release];
DESTROY(self);
return nil;
}
_fileName = [fileName copy];
@ -320,13 +320,13 @@ GSPrivateBaseAddress(void *addr, void **base)
if (!_abfd)
{
//NSLog (@"GSBinaryFileInfo: No Binary Info");
[self release];
DESTROY(self);
return nil;
}
if (!bfd_check_format_matches (_abfd, bfd_object, NULL))
{
//NSLog (@"GSBinaryFileInfo: BFD format object error");
[self release];
DESTROY(self);
return nil;
}
@ -334,7 +334,7 @@ GSPrivateBaseAddress(void *addr, void **base)
if (!(bfd_get_file_flags (_abfd) & HAS_SYMS))
{
//NSLog (@"GSBinaryFileInfo: BFD does not contain any symbols");
[self release];
DESTROY(self);
return nil;
}
@ -342,27 +342,27 @@ GSPrivateBaseAddress(void *addr, void **base)
if (neededSpace < 0)
{
//NSLog (@"GSBinaryFileInfo: BFD error while deducing needed space");
[self release];
DESTROY(self);
return nil;
}
if (neededSpace == 0)
{
//NSLog (@"GSBinaryFileInfo: BFD no space for symbols needed");
[self release];
DESTROY(self);
return nil;
}
_symbols = objc_malloc (neededSpace);
if (!_symbols)
{
//NSLog (@"GSBinaryFileInfo: Can't allocate buffer");
[self release];
DESTROY(self);
return nil;
}
_symbolCount = bfd_canonicalize_symtab (_abfd, _symbols);
if (_symbolCount < 0)
{
//NSLog (@"GSBinaryFileInfo: BFD error while reading symbols");
[self release];
DESTROY(self);
return nil;
}
@ -838,7 +838,7 @@ callUncaughtHandler(id value)
*/
- (id) init
{
[self release];
DESTROY(self);
return nil;
}

View file

@ -151,13 +151,13 @@ static NSMutableDictionary *_hostCache = nil;
{
NSLog(@"Host '%@' init failed - perhaps the name/address is wrong or "
@"networking is not set up on your machine", name);
RELEASE(self);
DESTROY(self);
return nil;
}
else if (name == nil && entry != (struct hostent*)NULL)
{
NSLog(@"Nil hostname supplied but network database entry is not empty");
RELEASE(self);
DESTROY(self);
return nil;
}
@ -506,7 +506,7 @@ myHostName()
host = [NSHost currentHost];
}
IF_NO_GC([host retain];)
RELEASE(self);
DESTROY(self);
return host;
}

View file

@ -313,7 +313,7 @@ static NSIndexPath *dummy = nil;
[aCoder decodeValueOfObjCType: @encode(NSUInteger) at: &length];
if (length == 0)
{
RELEASE(self);
DESTROY(self);
self = empty;
}
else
@ -386,7 +386,7 @@ static NSIndexPath *dummy = nil;
}
else
{
RELEASE(self);
DESTROY(self);
self = RETAIN(found);
}
[lock unlock];

View file

@ -710,7 +710,7 @@ _arg_addr(NSInvocation *inv, int index)
newSig = [NSMethodSignature signatureWithObjCTypes: types];
NSZoneFree(NSDefaultMallocZone(), (void*)types);
RELEASE(self);
DESTROY(self);
self = RETAIN([NSInvocation invocationWithMethodSignature: newSig]);
[aCoder decodeValueOfObjCType: @encode(id) at: &_target];
@ -806,7 +806,7 @@ _arg_addr(NSInvocation *inv, int index)
{
NSLog(@"Couldn't find encoding type for selector %s.",
sel_getName(aSelector));
RELEASE(self);
DESTROY(self);
return nil;
}
newSig = [NSMethodSignature signatureWithObjCTypes: types];

View file

@ -183,7 +183,7 @@
if (!([anObject respondsToSelector: insert]
&& [anObject respondsToSelector: remove]))
{
[self release];
DESTROY(self);
return nil;
}
replace = NSSelectorFromString
@ -317,7 +317,7 @@
if (![anObject respondsToSelector: set])
{
[self release];
DESTROY(self);
return nil;
}

View file

@ -237,7 +237,7 @@
if (!canAdd || !canRemove)
{
[self release];
DESTROY(self);
return nil;
}
@ -427,7 +427,7 @@
if (![anObject respondsToSelector: setSelector])
{
[self release];
DESTROY(self);
return nil;
}

View file

@ -1326,7 +1326,7 @@ replacementForClass(Class c)
[observedObjectForForwarding removeObserver: self forKeyPath:
keyForForwarding];
}
[self release];
DESTROY(self);
}
- (void) dealloc

View file

@ -816,7 +816,7 @@ static NSDictionary *makeReference(unsigned ref)
- (id) init
{
Class c = [self class];
RELEASE(self);
DESTROY(self);
[NSException raise: NSInvalidArgumentException
format: @"-[%@ init]: cannot use -init for initialisation",
NSStringFromClass(c)];

View file

@ -759,7 +759,7 @@ static NSMapTable *globalClassMap = 0;
- (id) init
{
Class c = [self class];
RELEASE(self);
DESTROY(self);
[NSException raise: NSInvalidArgumentException
format: @"-[%@ init]: cannot use -init for initialisation",
NSStringFromClass(c)];

View file

@ -201,7 +201,7 @@ MFINALIZE
{
if (0 != pthread_mutex_init(&_mutex, &attr_reporting))
{
[self release];
DESTROY(self);
self = nil;
}
}
@ -250,7 +250,7 @@ MFINALIZE
{
if (0 != pthread_mutex_init(&_mutex, &attr_recursive))
{
[self release];
DESTROY(self);
self = nil;
}
}
@ -293,13 +293,13 @@ MDESCRIPTION
}
if (0 != pthread_cond_init(&_condition, NULL))
{
[self release];
DESTROY(self);
return nil;
}
if (0 != pthread_mutex_init(&_mutex, &attr_reporting))
{
pthread_cond_destroy(&_condition);
[self release];
DESTROY(self);
return nil;
}
return self;
@ -383,7 +383,7 @@ MUNLOCK
}
if (nil == (_condition = [NSCondition new]))
{
[self release];
DESTROY(self);
return nil;
}
_condition_value = value;

View file

@ -1035,7 +1035,7 @@ static Class runLoopClass;
sent = YES;
}
M_UNLOCK(myLock);
RELEASE(self);
DESTROY(self);
NSDebugMLLog(@"NSMessagePort_details",
@"Message send 0x%x on 0x%x status %d", components, self, sent);
return sent;
@ -1571,7 +1571,7 @@ typedef struct {
- (id) init
{
RELEASE(self);
DESTROY(self);
self = [messagePortClass new];
return self;
}
@ -1612,7 +1612,7 @@ typedef struct {
[super invalidate];
}
M_UNLOCK(myLock);
RELEASE(self);
DESTROY(self);
}
}
@ -1742,7 +1742,7 @@ typedef struct {
[self invalidate];
}
M_UNLOCK(myLock);
RELEASE(self);
DESTROY(self);
}
/*

View file

@ -374,7 +374,7 @@ next_arg(const char *typePtr, NSArgumentInfo *info, char *outTypes)
if (t == 0 || *t == '\0')
{
[self release];
DESTROY(self);
self = nil;
}
else

View file

@ -117,7 +117,7 @@ static Class concreteClass = 0;
{
NSZone *z = [self zone];
RELEASE(self);
DESTROY(self);
self = (id)NSAllocateObject (concreteClass, 0, z);
}
return self;
@ -181,7 +181,7 @@ static Class concreteClass = 0;
RELEASE(name);
RELEASE(object);
RELEASE(info);
RELEASE(self);
DESTROY(self);
return RETAIN(n);
}

View file

@ -387,7 +387,7 @@ static Class NSDoubleNumberClass;
#define INTEGER_MACRO(type, ignored, name) \
- (id) initWith ## name: (type)aValue \
{\
[self release];\
DESTROY(self);\
return [[NSNumberClass numberWith ## name: aValue] retain];\
}
@ -395,7 +395,7 @@ static Class NSDoubleNumberClass;
- (id) initWithBool: (BOOL)aValue
{
[self release];
DESTROY(self);
return [ReusedInstances[aValue ? 2 : 1] retain];\
}
@ -620,7 +620,7 @@ if (aValue >= -1 && aValue <= 12)\
*/
- (id) init
{
[self release];
DESTROY(self);
return nil;
}

View file

@ -555,7 +555,7 @@ NSAllocateObject(Class aClass, NSUInteger extraBytes, NSZone *zone)
NSCAssert((CLS_ISCLASS(aClass)), @"Bad class for new object");
gc_type = (GC_descr)aClass->gc_object_type;
size = aClass->instance_size + extraBytes;
size = class_getInstanceSize(aClass) + extraBytes;
if (size % sizeof(void*) != 0)
{
/* Size must be a multiple of pointer size for the garbage collector
@ -613,7 +613,7 @@ NSAllocateObject (Class aClass, NSUInteger extraBytes, NSZone *zone)
int size;
NSCAssert((CLS_ISCLASS(aClass)), @"Bad class for new object");
size = aClass->instance_size + extraBytes + sizeof(struct obj_layout);
size = class_getInstanceSize(aClass) + extraBytes + sizeof(struct obj_layout);
if (zone == 0)
{
zone = NSDefaultMallocZone();

View file

@ -136,7 +136,7 @@ static Class NSPort_concrete_class;
if (obj != self)
{
RELEASE(self);
DESTROY(self);
self = RETAIN(obj);
}
return self;

View file

@ -764,7 +764,7 @@ static inline BOOL timerInvalidated(NSTimer *t)
- (id) init
{
[self release];
DESTROY(self);
return nil;
}

View file

@ -241,7 +241,7 @@ typedef GSString *ivars;
}
else
{
RELEASE(self);
DESTROY(self);
NSLog(@"Scanner initialised with something not a string");
return nil;
}

View file

@ -213,13 +213,13 @@ static Class NSMutableSet_concrete_class;
c = object_getClass(self);
if (c == NSSet_abstract_class)
{
RELEASE(self);
DESTROY(self);
self = [NSSet_concrete_class allocWithZone: NSDefaultMallocZone()];
return [self initWithCoder: aCoder];
}
else if (c == NSMutableSet_abstract_class)
{
RELEASE(self);
DESTROY(self);
self = [NSMutableSet_concrete_class allocWithZone: NSDefaultMallocZone()];
return [self initWithCoder: aCoder];
}

View file

@ -1436,7 +1436,7 @@ static Class runLoopClass;
sent = YES;
}
M_UNLOCK(myLock);
RELEASE(self);
DESTROY(self);
NSDebugMLLog(@"GSTcpHandle",
@"Message send 0x%x on 0x%x status %d", components, self, sent);
return sent;
@ -2042,7 +2042,7 @@ static Class tcpPortClass;
- (id) init
{
RELEASE(self);
DESTROY(self);
self = [tcpPortClass new];
return self;
}
@ -2100,7 +2100,7 @@ static Class tcpPortClass;
[super invalidate];
}
M_UNLOCK(myLock);
RELEASE(self);
DESTROY(self);
}
}
@ -2258,7 +2258,7 @@ static Class tcpPortClass;
* been retained - we must therefore release this port since the
* handle no longer uses it.
*/
IF_NO_GC(AUTORELEASE(self);)
DESTROY(self);
}
handle->sendPort = nil;
}
@ -2275,7 +2275,7 @@ static Class tcpPortClass;
[self invalidate];
}
M_UNLOCK(myLock);
RELEASE(self);
DESTROY(self);
}
/*

View file

@ -1202,14 +1202,14 @@ handle_printf_atsign (FILE *stream,
d = [[NSDataClass alloc] initWithContentsOfFile: path];
if (d == nil)
{
RELEASE(self);
DESTROY(self);
return nil;
}
len = [d length];
if (len == 0)
{
RELEASE(d);
RELEASE(self);
DESTROY(self);
return @"";
}
data_bytes = [d bytes];
@ -1268,7 +1268,7 @@ handle_printf_atsign (FILE *stream,
d = [[NSDataClass alloc] initWithContentsOfFile: path];
if (d == nil)
{
RELEASE(self);
DESTROY(self);
return nil;
}
*enc = _DefaultStringEncoding;
@ -1276,7 +1276,7 @@ handle_printf_atsign (FILE *stream,
if (len == 0)
{
RELEASE(d);
RELEASE(self);
DESTROY(self);
return @"";
}
data_bytes = [d bytes];
@ -1339,12 +1339,12 @@ handle_printf_atsign (FILE *stream,
if (d == nil)
{
NSWarnMLog(@"Contents of URL '%@' are not readable", url);
RELEASE(self);
DESTROY(self);
return nil;
}
if (len == 0)
{
RELEASE(self);
DESTROY(self);
return @"";
}
data_bytes = [d bytes];

View file

@ -549,6 +549,7 @@ static void setThreadForCurrentThread(NSThread *t)
* Ensure that the default thread exists.
*/
threadClass = self;
[NSThread _createThreadForCurrentPthread];
defaultThread = [NSThread currentThread];
@ -868,7 +869,7 @@ static void *nsthreadLauncher(void* thread)
}
if (pthread_create(&thr, &attr, nsthreadLauncher, self))
{
RELEASE(self);
DESTROY(self);
[NSException raise: NSInternalInconsistencyException
format: @"Unable to detach thread (last error %@)",
[NSError _last]];
@ -927,7 +928,7 @@ static void *nsthreadLauncher(void* thread)
#ifdef __MINGW32__
if ((event = CreateEvent(NULL, TRUE, FALSE, NULL)) == INVALID_HANDLE_VALUE)
{
RELEASE(self);
DESTROY(self);
[NSException raise: NSInternalInconsistencyException
format: @"Failed to create event to handle perform in thread"];
}
@ -957,7 +958,7 @@ static void *nsthreadLauncher(void* thread)
}
else
{
RELEASE(self);
DESTROY(self);
[NSException raise: NSInternalInconsistencyException
format: @"Failed to create pipe to handle perform in thread"];
}

View file

@ -470,7 +470,7 @@ static NSString *_time_zone_path(NSString *subpath, NSString *type)
#if defined(__MINGW32__)
{
zone = [[GSWindowsTimeZone alloc] initWithName: name data: 0];
RELEASE(self);
DESTROY(self);
return zone;
}
#else
@ -489,7 +489,7 @@ static NSString *_time_zone_path(NSString *subpath, NSString *type)
zone = [[GSTimeZone alloc] initWithName: name data: data];
}
}
RELEASE(self);
DESTROY(self);
return zone;
}
@ -657,7 +657,7 @@ static NSMapTable *absolutes = 0;
}
if (anOffset > 64800)
{
RELEASE(self);
DESTROY(self);
return nil;
}
anOffset *= sign;
@ -670,7 +670,7 @@ static NSMapTable *absolutes = 0;
if (z != nil)
{
IF_NO_GC(RETAIN(z));
RELEASE(self);
DESTROY(self);
}
else
{

View file

@ -66,7 +66,7 @@ static Class NSDate_class;
*/
- (id) init
{
[self release];
DESTROY(self);
return nil;
}

View file

@ -687,7 +687,7 @@ static unsigned urlAlign;
}
if ([aUrlString length] == 0)
{
RELEASE(self);
DESTROY(self);
return nil;
}
ASSIGNCOPY(_urlString, aUrlString);
@ -1872,7 +1872,7 @@ static unsigned urlAlign;
NSMapRemove((NSMapTable*)_clients, (void*)sender);
[clientsLock unlock];
}
RELEASE(self);
DESTROY(self);
}
@end

View file

@ -105,7 +105,7 @@ typedef struct {
{
if (user == nil)
{
RELEASE(self);
DESTROY(self);
return nil;
}
if ((self = [super init]) != nil)

View file

@ -110,7 +110,7 @@ static NSURLCredentialStorage *storage = nil;
// Should never be called.
- (id) init
{
RELEASE(self);
DESTROY(self);
return nil;
}

View file

@ -321,7 +321,7 @@ static Class NSURLHandleClass = 0;
@selector(URLHandleResourceDidCancelLoading:)
withObject: self];
[self endLoadInBackground];
IF_NO_GC([self release];)
IF_NO_GC(DESTROY(self);)
}
- (void) dealloc
@ -710,7 +710,7 @@ static NSLock *fileLock = nil;
if ([url isFileURL] == NO)
{
NSLog(@"Attempt to init GSFileURLHandle with bad URL");
RELEASE(self);
DESTROY(self);
return nil;
}
path = [url path];

View file

@ -156,7 +156,7 @@ static NSLock *pairLock = nil;
- (id) init
{
[self release];
DESTROY(self);
return nil;
}
@ -180,7 +180,7 @@ static NSLock *pairLock = nil;
{
/* Found a match ... remove from cache and return as self.
*/
[self release];
DESTROY(self);
self = [pair retain];
[pairCache removeObjectAtIndex: count];
[pairLock unlock];
@ -197,7 +197,7 @@ static NSLock *pairLock = nil;
outputStream: &op];
if (ip == nil || op == nil)
{
[self release];
DESTROY(self);
return nil;
}
ssl = s;

View file

@ -496,7 +496,7 @@ static Class NSDataMallocClass;
}
NS_HANDLER
{
RELEASE(self);
DESTROY(self);
[localException raise];
}
NS_ENDHANDLER

View file

@ -577,7 +577,7 @@ static NSLock *placeholderLock;
{
NSZoneFree(NSDefaultMallocZone(), (void*)objctype);
}
RELEASE(self);
DESTROY(self);
self = o;
return self;
}

View file

@ -519,13 +519,13 @@
- (id) initWithData: (NSData *)data
{
RELEASE(self);
DESTROY(self);
return [[GSDataInputStream alloc] initWithData: data];
}
- (id) initWithFileAtPath: (NSString *)path
{
RELEASE(self);
DESTROY(self);
return [[GSFileInputStream alloc] initWithFileAtPath: path];
}
@ -564,20 +564,20 @@
- (id) initToBuffer: (uint8_t *)buffer capacity: (NSUInteger)capacity
{
RELEASE(self);
DESTROY(self);
return [[GSBufferOutputStream alloc] initToBuffer: buffer capacity: capacity];
}
- (id) initToFileAtPath: (NSString *)path append: (BOOL)shouldAppend
{
RELEASE(self);
DESTROY(self);
return [[GSFileOutputStream alloc] initToFileAtPath: path
append: shouldAppend];
}
- (id) initToMemory
{
RELEASE(self);
DESTROY(self);
return [[GSDataOutputStream alloc] init];
}

View file

@ -701,7 +701,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if (s == nil)
{
NSLog(@"bad argument - service is nil");
RELEASE(self);
DESTROY(self);
return nil;
}
@ -723,7 +723,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if (getAddr(lhost, p, @"tcp", &lsin) == NO)
{
NSLog(@"bad bind address specification");
RELEASE(self);
DESTROY(self);
return nil;
}
p = @"tcp";
@ -769,7 +769,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if (getAddr(a, s, p, &sin) == NO)
{
RELEASE(self);
DESTROY(self);
NSLog(@"bad address-service-protocol combination");
return nil;
}
@ -793,7 +793,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if (getAddr(shost, sport, p, &sin) == NO)
{
NSLog(@"bad SOCKS host-port combination");
RELEASE(self);
DESTROY(self);
return nil;
}
}
@ -801,7 +801,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if ((net = socket(AF_INET, SOCK_STREAM, PF_UNSPEC)) == INVALID_SOCKET)
{
NSLog(@"unable to create socket - %@", [NSError _last]);
RELEASE(self);
DESTROY(self);
return nil;
}
/*
@ -817,7 +817,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
NSLog(@"unable to bind to port %s:%d - %@", inet_ntoa(lsin.sin_addr),
GSSwapBigI16ToHost(sin.sin_port), [NSError _last]);
(void) closesocket(net);
RELEASE(self);
DESTROY(self);
return nil;
}
}
@ -836,7 +836,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
NSLog(@"unable to make connection to %s:%d - %@",
inet_ntoa(sin.sin_addr),
GSSwapBigI16ToHost(sin.sin_port), [NSError _last]);
RELEASE(self);
DESTROY(self);
return nil;
}
}
@ -892,7 +892,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if (getAddr(a, s, p, &sin) == NO)
{
RELEASE(self);
DESTROY(self);
NSLog(@"bad address-service-protocol combination");
return nil;
}
@ -900,7 +900,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if ((net = socket(AF_INET, SOCK_STREAM, PF_UNSPEC)) == INVALID_SOCKET)
{
NSLog(@"unable to create socket - %@", [NSError _last]);
RELEASE(self);
DESTROY(self);
return nil;
}
@ -919,7 +919,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
NSLog(@"unable to bind to port %s:%d - %@", inet_ntoa(sin.sin_addr),
GSSwapBigI16ToHost(sin.sin_port), [NSError _last]);
(void) closesocket(net);
RELEASE(self);
DESTROY(self);
return nil;
}
@ -927,7 +927,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
{
NSLog(@"unable to listen on port - %@", [NSError _last]);
(void) closesocket(net);
RELEASE(self);
DESTROY(self);
return nil;
}
@ -935,7 +935,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
{
NSLog(@"unable to get socket name - %@", [NSError _last]);
(void) closesocket(net);
RELEASE(self);
DESTROY(self);
return nil;
}
@ -960,7 +960,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if (d < 0)
{
RELEASE(self);
DESTROY(self);
return nil;
}
else
@ -984,7 +984,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if (d < 0)
{
RELEASE(self);
DESTROY(self);
return nil;
}
else
@ -1008,7 +1008,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if (d < 0)
{
RELEASE(self);
DESTROY(self);
return nil;
}
else
@ -1028,7 +1028,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if (fh_stderr != nil)
{
RETAIN(fh_stderr);
RELEASE(self);
DESTROY(self);
}
else
{
@ -1048,7 +1048,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if (fh_stdin != nil)
{
RETAIN(fh_stdin);
RELEASE(self);
DESTROY(self);
}
else
{
@ -1068,7 +1068,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if (fh_stdout != nil)
{
RETAIN(fh_stdout);
RELEASE(self);
DESTROY(self);
}
else
{
@ -1089,7 +1089,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if (d < 0)
{
RELEASE(self);
DESTROY(self);
return nil;
}
else

View file

@ -386,7 +386,7 @@ static Class messagePortClass = 0;
else
{
found = YES;
RELEASE(self);
DESTROY(self);
self = p;
}
@ -460,7 +460,7 @@ static Class messagePortClass = 0;
}
M_UNLOCK(this->lock);
}
RELEASE(self);
DESTROY(self);
}
- (BOOL) isEqual: (id)anObject
@ -917,7 +917,7 @@ again:
forMode: mode
all: YES];
}
RELEASE(self);
DESTROY(self);
}
@ -1131,7 +1131,7 @@ again:
}
}
M_UNLOCK(this->lock);
RELEASE(self);
DESTROY(self);
RELEASE(h);
return sent;

View file

@ -1217,13 +1217,13 @@ done:
- (id) initWithData: (NSData *)data
{
RELEASE(self);
DESTROY(self);
return [[GSDataInputStream alloc] initWithData: data];
}
- (id) initWithFileAtPath: (NSString *)path
{
RELEASE(self);
DESTROY(self);
return [[GSFileInputStream alloc] initWithFileAtPath: path];
}
@ -1262,20 +1262,20 @@ done:
- (id) initToBuffer: (uint8_t *)buffer capacity: (NSUInteger)capacity
{
RELEASE(self);
DESTROY(self);
return [[GSBufferOutputStream alloc] initToBuffer: buffer capacity: capacity];
}
- (id) initToFileAtPath: (NSString *)path append: (BOOL)shouldAppend
{
RELEASE(self);
DESTROY(self);
return [[GSFileOutputStream alloc] initToFileAtPath: path
append: shouldAppend];
}
- (id) initToMemory
{
RELEASE(self);
DESTROY(self);
return [[GSDataOutputStream alloc] init];
}