mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-29 16:01:38 +00:00
garbage collection fixups
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@27578 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
43ad91f79e
commit
952af9c197
65 changed files with 707 additions and 214 deletions
|
@ -103,9 +103,11 @@ _GCCompareObjects(NSMapTable *table, const GCInfo *o1, const GCInfo *o2)
|
|||
static void
|
||||
_GCRetainObjects(NSMapTable *table, const void *ptr)
|
||||
{
|
||||
#if !GS_WITH_GC
|
||||
GCInfo *objectStruct = (GCInfo*)ptr;
|
||||
|
||||
RETAIN(objectStruct->object);
|
||||
[objectStruct->object retain];
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -45,7 +45,9 @@ Additions_OBJC_FILES =\
|
|||
behavior.m
|
||||
|
||||
ifneq ($(OBJC_RUNTIME_LIB), gnu)
|
||||
Additions_OBJC_FILES += GSNextRuntime.m
|
||||
ifneq ($(OBJC_RUNTIME_LIB), gnugc)
|
||||
Additions_OBJC_FILES += GSNextRuntime.m
|
||||
endif
|
||||
endif
|
||||
ifneq ($(FOUNDATION_LIB), gnu)
|
||||
Additions_OBJC_FILES += GSCompatibility.m
|
||||
|
|
|
@ -784,7 +784,7 @@ static void MD5Transform (uint32_t buf[4], uint32_t const in[16])
|
|||
d = [NSData dataWithBytes: &bytes[off] length: end - off];
|
||||
name = [[NSString alloc] initWithData: d
|
||||
encoding: NSASCIIStringEncoding];
|
||||
AUTORELEASE(name);
|
||||
IF_NO_GC(AUTORELEASE(name);)
|
||||
if (namePtr != 0)
|
||||
{
|
||||
*namePtr = name;
|
||||
|
|
|
@ -681,7 +681,7 @@ wordData(NSString *word)
|
|||
if ([parser isComplete] == YES)
|
||||
{
|
||||
newDocument = [parser mimeDocument];
|
||||
RETAIN(newDocument);
|
||||
IF_NO_GC(RETAIN(newDocument);)
|
||||
}
|
||||
RELEASE(parser);
|
||||
return AUTORELEASE(newDocument);
|
||||
|
@ -853,7 +853,7 @@ wordData(NSString *word)
|
|||
tmp = [[NSString alloc] initWithBytes: buffer
|
||||
length: buflen
|
||||
encoding: NSASCIIStringEncoding];
|
||||
AUTORELEASE(tmp);
|
||||
IF_NO_GC([tmp autorelease];)
|
||||
return [tmp lowercaseString];
|
||||
}
|
||||
buflen = 0;
|
||||
|
@ -2498,7 +2498,7 @@ NSDebugMLLog(@"GSMime", @"Header parsed - %@", info);
|
|||
expect = 0;
|
||||
}
|
||||
context = [self contextFor: hdr];
|
||||
RETAIN(context);
|
||||
IF_NO_GC([context retain];)
|
||||
NSDebugMLLog(@"GSMime", @"Parse body expects %u bytes", expect);
|
||||
}
|
||||
|
||||
|
@ -3821,7 +3821,7 @@ appendString(NSMutableData *m, unsigned offset, unsigned fold,
|
|||
{
|
||||
r = [NSStringClass allocWithZone: NSDefaultMallocZone()];
|
||||
r = [r initWithData: d encoding: NSASCIIStringEncoding];
|
||||
AUTORELEASE(r);
|
||||
IF_NO_GC([r autorelease];)
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
@ -3882,7 +3882,7 @@ appendString(NSMutableData *m, unsigned offset, unsigned fold,
|
|||
{
|
||||
r = [NSStringClass allocWithZone: NSDefaultMallocZone()];
|
||||
r = [r initWithData: d encoding: NSASCIIStringEncoding];
|
||||
AUTORELEASE(r);
|
||||
IF_NO_GC([r autorelease];)
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
@ -4753,7 +4753,7 @@ appendString(NSMutableData *m, unsigned offset, unsigned fold,
|
|||
enc = [documentClass encodingFromCharset: charset];
|
||||
s = [NSStringClass allocWithZone: NSDefaultMallocZone()];
|
||||
s = [s initWithData: content encoding: enc];
|
||||
AUTORELEASE(s);
|
||||
IF_NO_GC([s autorelease];)
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
@ -5620,7 +5620,7 @@ appendString(NSMutableData *m, unsigned offset, unsigned fold,
|
|||
hdr = [hdr initWithName: @"content-type" value: val parameters: nil];
|
||||
[hdr setObject: type forKey: @"Type"];
|
||||
[hdr setObject: subtype forKey: @"Subtype"];
|
||||
AUTORELEASE(hdr);
|
||||
IF_NO_GC([hdr autorelease];)
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -3800,7 +3800,7 @@ fatalErrorFunction(void *ctx, const unsigned char *msg, ...)
|
|||
else
|
||||
{
|
||||
result = [GSXPathObject _newWithNativePointer: res context: self];
|
||||
AUTORELEASE (result);
|
||||
IF_NO_GC ([result autorelease];)
|
||||
}
|
||||
xmlXPathFreeCompExpr (comp);
|
||||
|
||||
|
@ -4034,7 +4034,7 @@ static BOOL warned = NO; if (warned == NO) { warned = YES; NSLog(@"WARNING, use
|
|||
newdoc = [newdoc _initFrom: res
|
||||
parent: self
|
||||
ownsLib: YES];
|
||||
AUTORELEASE(newdoc);
|
||||
IF_NO_GC([newdoc autorelease];)
|
||||
}
|
||||
}
|
||||
/*
|
||||
|
@ -4316,7 +4316,7 @@ static BOOL warned = NO; if (warned == NO) { warned = YES; NSLog(@"WARNING, use
|
|||
}
|
||||
self = [[NSString alloc] initWithCharacters: to length: output];
|
||||
NSZoneFree (NSDefaultMallocZone (), to);
|
||||
AUTORELEASE(self);
|
||||
IF_NO_GC([self autorelease];)
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -91,25 +91,27 @@ preface.m \
|
|||
mframe.m
|
||||
|
||||
ifeq ($(findstring openbsd, $(GNUSTEP_TARGET_OS)), openbsd)
|
||||
GNU_MFILES += thr-pthread.m
|
||||
OBJC_LIBS += -lpthread
|
||||
GNU_MFILES += thr-pthread.m
|
||||
OBJC_LIBS += -lpthread
|
||||
endif
|
||||
|
||||
ifneq ($(OBJC_RUNTIME_LIB), gnu)
|
||||
GNU_MFILES += objc-gnu2next.m
|
||||
ifeq ($(HAVE_PTHREAD_H), yes)
|
||||
GNU_MFILES += thr-pthread.m
|
||||
else
|
||||
GNU_MFILES += thr-mach.m
|
||||
endif
|
||||
ifneq ($(OBJC_RUNTIME_LIB), gnugc)
|
||||
GNU_MFILES += objc-gnu2next.m
|
||||
ifeq ($(HAVE_PTHREAD_H), yes)
|
||||
GNU_MFILES += thr-pthread.m
|
||||
else
|
||||
GNU_MFILES += thr-mach.m
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(GNUSTEP_TARGET_OS), mingw32)
|
||||
GNU_MFILES += libgnustep-base-entry.m
|
||||
GNU_MFILES += libgnustep-base-entry.m
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_OBJC_SYNC_ENTER), no)
|
||||
GNU_MFILES += synchronization.m
|
||||
GNU_MFILES += synchronization.m
|
||||
endif
|
||||
|
||||
|
||||
|
|
|
@ -533,7 +533,7 @@ GSFFIInvocationCallback(ffi_cif *cif, void *retp, void **args, void *user)
|
|||
values: args
|
||||
frame: user
|
||||
signature: sig];
|
||||
AUTORELEASE(invocation);
|
||||
IF_NO_GC([invocation autorelease];)
|
||||
[invocation setTarget: obj];
|
||||
[invocation setSelector: selector];
|
||||
|
||||
|
@ -555,7 +555,7 @@ GSFFIInvocationCallback(ffi_cif *cif, void *retp, void **args, void *user)
|
|||
if ([sig methodReturnType] && *[sig methodReturnType] == _C_ID
|
||||
&& ((NSInvocation_t *)invocation)->_validReturn == YES)
|
||||
{
|
||||
AUTORELEASE(*(id *)retp);
|
||||
IF_NO_GC([*(id *)retp autorelease];)
|
||||
((NSInvocation_t *)invocation)->_validReturn = NO;
|
||||
}
|
||||
|
||||
|
|
|
@ -529,7 +529,7 @@ static NSLock *urlLock = nil;
|
|||
// NSLog(@"Lookup for handle for '%@'", page);
|
||||
[urlLock lock];
|
||||
obj = [urlCache objectForKey: page];
|
||||
AUTORELEASE(RETAIN(obj));
|
||||
IF_NO_GC([[obj retain] autorelease];)
|
||||
[urlLock unlock];
|
||||
// NSLog(@"Found handle %@", obj);
|
||||
}
|
||||
|
@ -729,7 +729,7 @@ static NSLock *urlLock = nil;
|
|||
dHandle = [NSFileHandle
|
||||
fileHandleAsClientInBackgroundAtAddress: h service: p
|
||||
protocol: @"tcp"];
|
||||
RETAIN(dHandle);
|
||||
IF_NO_GC([dHandle retain];)
|
||||
nc = [NSNotificationCenter defaultCenter];
|
||||
[nc addObserver: self
|
||||
selector: @selector(_data:)
|
||||
|
|
|
@ -1019,7 +1019,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
{
|
||||
if (fh_stderr != nil)
|
||||
{
|
||||
RETAIN(fh_stderr);
|
||||
IF_NO_GC([fh_stderr retain];)
|
||||
RELEASE(self);
|
||||
}
|
||||
else
|
||||
|
@ -1039,7 +1039,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
{
|
||||
if (fh_stdin != nil)
|
||||
{
|
||||
RETAIN(fh_stdin);
|
||||
IF_NO_GC([fh_stdin retain];)
|
||||
RELEASE(self);
|
||||
}
|
||||
else
|
||||
|
@ -1059,7 +1059,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
{
|
||||
if (fh_stdout != nil)
|
||||
{
|
||||
RETAIN(fh_stdout);
|
||||
IF_NO_GC([fh_stdout retain];)
|
||||
RELEASE(self);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -135,7 +135,7 @@ static GSMimeParser *mimeParser = nil;
|
|||
RELEASE(authentication);
|
||||
}
|
||||
}
|
||||
AUTORELEASE(RETAIN(authentication));
|
||||
IF_NO_GC([[authentication retain] autorelease];)
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
|
|
|
@ -291,7 +291,7 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
|
|||
{
|
||||
[urlOrder removeObjectIdenticalTo: obj];
|
||||
[urlOrder addObject: obj];
|
||||
AUTORELEASE(RETAIN(obj));
|
||||
IF_NO_GC([[obj retain] autorelease];)
|
||||
}
|
||||
[urlLock unlock];
|
||||
//NSLog(@"Found handle %@", obj);
|
||||
|
@ -310,7 +310,7 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
|
|||
debugFile = [NSString stringWithFormat: @"%@/GSHTTP.%d",
|
||||
NSTemporaryDirectory(),
|
||||
[[NSProcessInfo processInfo] processIdentifier]];
|
||||
RETAIN(debugFile);
|
||||
IF_NO_GC([debugFile retain];)
|
||||
|
||||
#if !defined(__MINGW32__)
|
||||
sslClass = [NSFileHandle sslClass];
|
||||
|
@ -404,7 +404,7 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
|
|||
NSString *version;
|
||||
NSMapEnumerator enumerator;
|
||||
|
||||
RETAIN(self);
|
||||
IF_NO_GC([self retain];)
|
||||
if (debug) NSLog(@"%@ %s", NSStringFromSelector(_cmd), keepalive?"K":"");
|
||||
|
||||
s = [basic mutableCopy];
|
||||
|
@ -549,7 +549,7 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
|
|||
NSRange r;
|
||||
unsigned readCount;
|
||||
|
||||
RETAIN(self);
|
||||
IF_NO_GC([self retain];)
|
||||
|
||||
if (debug) NSLog(@"%@ %s", NSStringFromSelector(_cmd), keepalive?"K":"");
|
||||
d = [dict objectForKey: NSFileHandleNotificationDataItem];
|
||||
|
@ -801,7 +801,7 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
|
|||
NSData *d;
|
||||
GSMimeParser *p = [GSMimeParser new];
|
||||
|
||||
RETAIN(self);
|
||||
IF_NO_GC([self retain];)
|
||||
if (debug) NSLog(@"%@ %s", NSStringFromSelector(_cmd), keepalive?"K":"");
|
||||
d = [dict objectForKey: NSFileHandleNotificationDataItem];
|
||||
if (debug == YES) debugRead(self, d);
|
||||
|
@ -875,7 +875,7 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
|
|||
NSString *method;
|
||||
NSString *path;
|
||||
|
||||
RETAIN(self);
|
||||
IF_NO_GC([self retain];)
|
||||
if (debug) NSLog(@"%@ %s", NSStringFromSelector(_cmd), keepalive?"K":"");
|
||||
|
||||
path = [[u path] stringByTrimmingSpaces];
|
||||
|
@ -1046,7 +1046,7 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
|
|||
NSDictionary *userInfo = [notification userInfo];
|
||||
NSString *e;
|
||||
|
||||
RETAIN(self);
|
||||
IF_NO_GC([self retain];)
|
||||
if (debug) NSLog(@"%@ %s", NSStringFromSelector(_cmd), keepalive?"K":"");
|
||||
e = [userInfo objectForKey: GSFileHandleNotificationError];
|
||||
if (e != nil)
|
||||
|
@ -1410,7 +1410,7 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
|
|||
host, port, [NSError _last]]];
|
||||
return;
|
||||
}
|
||||
RETAIN(sock);
|
||||
IF_NO_GC([sock retain];)
|
||||
nc = [NSNotificationCenter defaultCenter];
|
||||
[nc addObserver: self
|
||||
selector: @selector(bgdConnect:)
|
||||
|
|
|
@ -18,7 +18,8 @@
|
|||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#ifndef __GSInvocation_h_GNUSTEP_BASE_INCLUDE
|
||||
|
@ -59,6 +60,6 @@ GSFFIInvokeWithTargetAndImp(NSInvocation *inv, id anObject, IMP imp);
|
|||
}\
|
||||
} while (0)
|
||||
|
||||
#define RETAIN_RETURN_VALUE do { if (*_info[0].type == _C_ID) RETAIN (*(id*) _retval);} while (0)
|
||||
#define RETAIN_RETURN_VALUE IF_NO_GC(do { if (*_info[0].type == _C_ID) RETAIN (*(id*) _retval);} while (0))
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1953,7 +1953,7 @@ setNonBlocking(SOCKET fd)
|
|||
int result;
|
||||
socklen_t len = sizeof(error);
|
||||
|
||||
AUTORELEASE(RETAIN(self));
|
||||
IF_NO_GC([[self retain] autorelease];)
|
||||
[self _unschedule];
|
||||
result = getsockopt([self _sock], SOL_SOCKET, SO_ERROR, &error, &len);
|
||||
|
||||
|
@ -2356,7 +2356,7 @@ setNonBlocking(SOCKET fd)
|
|||
socklen_t len = sizeof(error);
|
||||
int result;
|
||||
|
||||
AUTORELEASE(RETAIN(self));
|
||||
IF_NO_GC([[self retain] autorelease];)
|
||||
[self _schedule];
|
||||
result
|
||||
= getsockopt((intptr_t)_loopID, SOL_SOCKET, SO_ERROR, &error, &len);
|
||||
|
|
|
@ -2604,9 +2604,8 @@ substring_c(GSStr self, NSRange aRange)
|
|||
o->_count = aRange.length;
|
||||
o->_flags.wide = 0;
|
||||
o->_flags.free = 0;
|
||||
ASSIGN(o->_parent, self);
|
||||
AUTORELEASE((id)o);
|
||||
return (id)o;
|
||||
ASSIGN(o->_parent, (id)self);
|
||||
return AUTORELEASE((id)o);
|
||||
}
|
||||
|
||||
static inline NSString*
|
||||
|
@ -2624,9 +2623,8 @@ substring_u(GSStr self, NSRange aRange)
|
|||
o->_count = aRange.length;
|
||||
o->_flags.wide = 1;
|
||||
o->_flags.free = 0;
|
||||
ASSIGN(o->_parent, self);
|
||||
AUTORELEASE((id)o);
|
||||
return (id)o;
|
||||
ASSIGN(o->_parent, (id)self);
|
||||
return AUTORELEASE((id)o);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1659,7 +1659,7 @@ compare(id elem1, id elem2, void* context)
|
|||
{
|
||||
id tmp = [self objectAtIndex: i1];
|
||||
|
||||
RETAIN(tmp);
|
||||
IF_NO_GC([tmp retain];)
|
||||
[self replaceObjectAtIndex: i1 withObject: [self objectAtIndex: i2]];
|
||||
[self replaceObjectAtIndex: i2 withObject: tmp];
|
||||
RELEASE(tmp);
|
||||
|
@ -1858,7 +1858,7 @@ compare(id elem1, id elem2, void* context)
|
|||
* first equal object we don't get left with a bad object
|
||||
* pointer for later comparisons.
|
||||
*/
|
||||
RETAIN(anObject);
|
||||
IF_NO_GC([anObject retain];)
|
||||
}
|
||||
(*rem)(self, remSel, i);
|
||||
}
|
||||
|
@ -1950,7 +1950,7 @@ compare(id elem1, id elem2, void* context)
|
|||
* first equal object we don't get left with a bad object
|
||||
* pointer for later comparisons.
|
||||
*/
|
||||
RETAIN(anObject);
|
||||
IF_NO_GC([anObject retain];)
|
||||
}
|
||||
(*rem)(self, remSel, i);
|
||||
}
|
||||
|
|
|
@ -268,7 +268,7 @@ GSPrivateExecutablePath()
|
|||
executablePath = AbsolutePathOfExecutable(executablePath, YES);
|
||||
}
|
||||
|
||||
RETAIN(executablePath);
|
||||
IF_NO_GC([executablePath retain];)
|
||||
beenHere = YES;
|
||||
}
|
||||
[load_lock unlock];
|
||||
|
@ -1216,10 +1216,12 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
|||
if (_byIdentifier)
|
||||
{
|
||||
bundle = (NSBundle *)NSMapGet(_byIdentifier, identifier);
|
||||
IF_NO_GC(
|
||||
if (bundle != nil)
|
||||
{
|
||||
RETAIN(bundle); /* retain - look as if we were alloc'ed */
|
||||
[bundle retain]; /* retain - look as if we were alloc'ed */
|
||||
}
|
||||
)
|
||||
}
|
||||
[load_lock unlock];
|
||||
return AUTORELEASE(bundle);
|
||||
|
@ -1295,7 +1297,7 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
|||
|
||||
if (bundle != nil)
|
||||
{
|
||||
RETAIN(bundle); /* retain - look as if we were alloc'ed */
|
||||
IF_NO_GC([bundle retain];)
|
||||
[load_lock unlock];
|
||||
[self dealloc];
|
||||
return bundle;
|
||||
|
@ -1347,7 +1349,7 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
|||
|
||||
if (bundle != nil)
|
||||
{
|
||||
RETAIN(bundle); /* retain - look as if we were alloc'ed */
|
||||
IF_NO_GC([bundle retain];)
|
||||
[load_lock unlock];
|
||||
[self dealloc];
|
||||
return bundle;
|
||||
|
@ -1371,7 +1373,7 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
|||
* dynamically loaded code, so we want to prevent a bundle
|
||||
* being loaded twice.
|
||||
*/
|
||||
RETAIN(self);
|
||||
IF_NO_GC([self retain];)
|
||||
return;
|
||||
}
|
||||
if (_path != nil)
|
||||
|
@ -1556,7 +1558,7 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
|||
We need it to answer calls like bundleForClass:; also, users
|
||||
normally want all loaded bundles to appear when they call
|
||||
+allBundles. */
|
||||
RETAIN (self);
|
||||
IF_NO_GC([self retain];)
|
||||
_loadingBundle = nil;
|
||||
|
||||
DESTROY(_loadingFrameworks);
|
||||
|
@ -1836,8 +1838,7 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
|||
}
|
||||
}
|
||||
}
|
||||
RETAIN(result);
|
||||
DESTROY(arp);
|
||||
IF_NO_GC([result retain]; DESTROY(arp);)
|
||||
return AUTORELEASE(result);
|
||||
}
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ static NSMapTable *classMap;
|
|||
object: aClass];
|
||||
description = NSMapGet(classMap, aClass);
|
||||
}
|
||||
RETAIN(description);
|
||||
IF_NO_GC([description retain];)
|
||||
[mapLock unlock];
|
||||
|
||||
return AUTORELEASE(description);
|
||||
|
|
|
@ -298,7 +298,7 @@ existingConnection(NSPort *receivePort, NSPort *sendPort)
|
|||
* We don't want this connection to be destroyed by another thread
|
||||
* between now and when it's returned from this function and used!
|
||||
*/
|
||||
AUTORELEASE(RETAIN(c));
|
||||
IF_NO_GC([[c retain] autorelease];)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -386,7 +386,7 @@ static NSLock *cached_proxies_gate = nil;
|
|||
{
|
||||
c = [self allocWithZone: NSDefaultMallocZone()];
|
||||
c = [c initWithReceivePort: r sendPort: s];
|
||||
AUTORELEASE(c);
|
||||
IF_NO_GC([c autorelease];)
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
@ -1150,7 +1150,7 @@ static NSLock *cached_proxies_gate = nil;
|
|||
*/
|
||||
[self setRequestMode: nil];
|
||||
|
||||
RETAIN(self);
|
||||
IF_NO_GC([self retain];)
|
||||
|
||||
if (debug_connection)
|
||||
{
|
||||
|
@ -3058,8 +3058,7 @@ static void callEncoder (DOContext *ctxt)
|
|||
if (cacheCoders == YES && _cachedDecoders != nil
|
||||
&& (count = [_cachedDecoders count]) > 0)
|
||||
{
|
||||
coder = [_cachedDecoders objectAtIndex: --count];
|
||||
RETAIN(coder);
|
||||
coder = RETAIN([_cachedDecoders objectAtIndex: --count]);
|
||||
[_cachedDecoders removeObjectAtIndex: count];
|
||||
}
|
||||
else
|
||||
|
@ -3112,8 +3111,7 @@ static void callEncoder (DOContext *ctxt)
|
|||
if (cacheCoders == YES && _cachedEncoders != nil
|
||||
&& (count = [_cachedEncoders count]) > 0)
|
||||
{
|
||||
coder = [_cachedEncoders objectAtIndex: --count];
|
||||
RETAIN(coder);
|
||||
coder = RETAIN([_cachedEncoders objectAtIndex: --count]);
|
||||
[_cachedEncoders removeObjectAtIndex: count];
|
||||
}
|
||||
else
|
||||
|
@ -3262,7 +3260,7 @@ static void callEncoder (DOContext *ctxt)
|
|||
node = GSIMapNodeForKey(_localTargets, (GSIMapKey)target);
|
||||
NSAssert(node == 0, NSInternalInconsistencyException);
|
||||
|
||||
RETAIN(anObj);
|
||||
IF_NO_GC([anObj retain];)
|
||||
GSIMapAddPair(_localObjects, (GSIMapKey)object, (GSIMapVal)((id)anObj));
|
||||
GSIMapAddPair(_localTargets, (GSIMapKey)target, (GSIMapVal)((id)anObj));
|
||||
|
||||
|
@ -3288,8 +3286,7 @@ static void callEncoder (DOContext *ctxt)
|
|||
}
|
||||
else
|
||||
{
|
||||
p = node->value.obj;
|
||||
RETAIN(p);
|
||||
p = RETAIN(node->value.obj);
|
||||
DESTROY(proxy);
|
||||
}
|
||||
if (p == nil && proxy != nil)
|
||||
|
@ -3642,8 +3639,7 @@ static void callEncoder (DOContext *ctxt)
|
|||
}
|
||||
else
|
||||
{
|
||||
p = node->value.obj;
|
||||
RETAIN(p);
|
||||
p = RETAIN(node->value.obj);
|
||||
DESTROY(aProxy);
|
||||
}
|
||||
if (p == nil && aProxy != nil)
|
||||
|
|
|
@ -801,11 +801,13 @@ GSDebugAllocationListRecordedObjects(Class c)
|
|||
the_table[i].num_recorded_objects * sizeof(id));
|
||||
|
||||
/* Retain all the objects - NB: if retaining one of the objects as a
|
||||
side effect releases another one of them , we are broken ... */
|
||||
side effect eleases another one of them , we are broken ... */
|
||||
#if !GS_WITH_GC
|
||||
for (k = 0; k < the_table[i].num_recorded_objects; k++)
|
||||
{
|
||||
RETAIN (tmp[k]);
|
||||
[tmp[k] retain];
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Then, we bravely unlock the lock */
|
||||
[uniqueLock unlock];
|
||||
|
|
|
@ -867,8 +867,8 @@ static NSDecimalNumber *one;
|
|||
double num;
|
||||
NSDecimalNumber *dnum;
|
||||
num = [self doubleValue];
|
||||
dnum = [[NSDecimalNumber alloc] initWithBytes: &num objCType: "d"];
|
||||
AUTORELEASE(dnum);
|
||||
dnum
|
||||
= AUTORELEASE([[NSDecimalNumber alloc] initWithBytes: &num objCType: "d"]);
|
||||
return [dnum decimalValue];
|
||||
}
|
||||
@end
|
||||
|
|
|
@ -674,8 +674,7 @@ enum proxyLocation
|
|||
|
||||
if (sig == nil)
|
||||
{
|
||||
sig = [NSMethodSignature signatureWithObjCTypes: "@@::"];
|
||||
RETAIN(sig);
|
||||
sig = RETAIN([NSMethodSignature signatureWithObjCTypes: "@@::"]);
|
||||
}
|
||||
return sig;
|
||||
}
|
||||
|
@ -690,8 +689,7 @@ enum proxyLocation
|
|||
|
||||
if (sig == nil)
|
||||
{
|
||||
sig = [NSMethodSignature signatureWithObjCTypes: "r*@:"];
|
||||
RETAIN(sig);
|
||||
sig = RETAIN([NSMethodSignature signatureWithObjCTypes: "r*@:"]);
|
||||
}
|
||||
return sig;
|
||||
}
|
||||
|
|
|
@ -744,8 +744,8 @@ static NSDistributedNotificationCenter *netCenter = nil;
|
|||
_remote = [NSConnection
|
||||
rootProxyForConnectionWithRegisteredName: service
|
||||
host: host usingNameServer: ns];
|
||||
RETAIN(_remote);
|
||||
DESTROY(pool);
|
||||
IF_NO_GC([_remote retain];)
|
||||
IF_NO_GC(DESTROY(pool);)
|
||||
}
|
||||
if (_remote == nil)
|
||||
{
|
||||
|
@ -755,10 +755,12 @@ static NSDistributedNotificationCenter *netCenter = nil;
|
|||
@"I attempted to start it at '%@'\n", cmd];
|
||||
}
|
||||
}
|
||||
#if !GS_WITH_GC
|
||||
else
|
||||
{
|
||||
RETAIN(_remote);
|
||||
[_remote retain];
|
||||
}
|
||||
#endif
|
||||
|
||||
c = [_remote connectionForProxy];
|
||||
[_remote setProtocolForProxy: p];
|
||||
|
|
|
@ -1008,8 +1008,8 @@ callUncaughtHandler(id value)
|
|||
result = [NSString stringWithFormat: @"%@ NAME:%@ REASON:%@",
|
||||
[super description], _e_name, _e_reason];
|
||||
}
|
||||
RETAIN(result);
|
||||
DESTROY(pool);
|
||||
IF_NO_GC([result retain];)
|
||||
IF_NO_GC(DESTROY(pool);)
|
||||
return AUTORELEASE(result);
|
||||
}
|
||||
|
||||
|
|
|
@ -2235,9 +2235,8 @@ static inline void gsedRelease(GSEnumeratedDirectory X)
|
|||
stringWithFileSystemRepresentation: dirbuf->d_name
|
||||
length: strlen(dirbuf->d_name)];
|
||||
#endif
|
||||
returnFileName = [dir.path stringByAppendingPathComponent:
|
||||
returnFileName];
|
||||
RETAIN(returnFileName);
|
||||
returnFileName = RETAIN([dir.path stringByAppendingPathComponent:
|
||||
returnFileName]);
|
||||
|
||||
/* TODO - can this one can be removed ? */
|
||||
if (!_flags.justContents)
|
||||
|
@ -2905,7 +2904,7 @@ static NSSet *fileKeys = nil;
|
|||
NSFileSystemNumber,
|
||||
NSFileType,
|
||||
nil];
|
||||
RETAIN(fileKeys);
|
||||
IF_NO_GC([fileKeys retain];)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -335,7 +335,7 @@ myHostName()
|
|||
* with ALL the IP addresses of any interfaces on the local machine
|
||||
*/
|
||||
host = [[self alloc] _initWithHostEntry: 0 key: localHostName];
|
||||
AUTORELEASE(host);
|
||||
IF_NO_GC([host autorelease];)
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -369,13 +369,13 @@ myHostName()
|
|||
else
|
||||
{
|
||||
host = [[self alloc] _initWithHostEntry: h key: name];
|
||||
AUTORELEASE(host);
|
||||
IF_NO_GC([host autorelease];)
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AUTORELEASE(RETAIN(host));
|
||||
IF_NO_GC([[host retain] autorelease];)
|
||||
}
|
||||
[_hostCacheLock unlock];
|
||||
if (tryByAddress == YES)
|
||||
|
@ -431,18 +431,18 @@ myHostName()
|
|||
if (badAddr == NO)
|
||||
{
|
||||
host = [[self alloc] _initWithAddress: address];
|
||||
AUTORELEASE(host);
|
||||
IF_NO_GC([host autorelease];)
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
host = [[self alloc] _initWithHostEntry: h key: address];
|
||||
AUTORELEASE(host);
|
||||
IF_NO_GC([host autorelease];)
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AUTORELEASE(RETAIN(host));
|
||||
IF_NO_GC([[host retain] autorelease];)
|
||||
}
|
||||
[_hostCacheLock unlock];
|
||||
return host;
|
||||
|
@ -507,7 +507,7 @@ myHostName()
|
|||
{
|
||||
host = [NSHost currentHost];
|
||||
}
|
||||
RETAIN(host);
|
||||
IF_NO_GC([host retain];)
|
||||
RELEASE(self);
|
||||
return host;
|
||||
}
|
||||
|
|
|
@ -60,8 +60,7 @@ static NSIndexPath *dummy = nil;
|
|||
id o = [self allocWithZone: NSDefaultMallocZone()];
|
||||
|
||||
o = [o initWithIndexes: indexes length: length];
|
||||
AUTORELEASE(o);
|
||||
return o;
|
||||
return AUTORELEASE(o);
|
||||
}
|
||||
|
||||
+ (void) initialize
|
||||
|
|
|
@ -823,8 +823,7 @@ _arg_addr(NSInvocation *inv, int index)
|
|||
NSZoneFree(NSDefaultMallocZone(), (void*)types);
|
||||
|
||||
RELEASE(self);
|
||||
self = [NSInvocation invocationWithMethodSignature: newSig];
|
||||
RETAIN(self);
|
||||
self = RETAIN([NSInvocation invocationWithMethodSignature: newSig]);
|
||||
|
||||
[aCoder decodeValueOfObjCType: @encode(id) at: &_target];
|
||||
|
||||
|
|
|
@ -1366,7 +1366,7 @@ replacementForClass(Class c)
|
|||
* turn off key-value-observing for it.
|
||||
*/
|
||||
isa = [self class];
|
||||
AUTORELEASE(info);
|
||||
IF_NO_GC(AUTORELEASE(info);)
|
||||
[self setObservationInfo: nil];
|
||||
}
|
||||
[kvoLock unlock];
|
||||
|
@ -1811,7 +1811,7 @@ triggerChangeNotificationsForDependentKey: (NSString*)dependentKey
|
|||
setup();
|
||||
[kvoLock lock];
|
||||
info = NSMapGet(infoTable, (void*)self);
|
||||
AUTORELEASE(RETAIN((id)info));
|
||||
IF_NO_GC(AUTORELEASE(RETAIN((id)info));)
|
||||
[kvoLock unlock];
|
||||
return info;
|
||||
}
|
||||
|
|
|
@ -787,7 +787,7 @@ static NSMapTable globalClassMap = 0;
|
|||
unsigned count;
|
||||
unsigned i;
|
||||
|
||||
RETAIN(_archive);
|
||||
IF_NO_GC(RETAIN(_archive);)
|
||||
_archiverClass = [_archive objectForKey: @"$archiver"];
|
||||
_version = [_archive objectForKey: @"$version"];
|
||||
|
||||
|
|
|
@ -874,7 +874,7 @@ static Class runLoopClass;
|
|||
DESTROY(rItems);
|
||||
NSDebugMLLog(@"NSMessagePort_details",
|
||||
@"got message %@ on 0x%x", pm, self);
|
||||
RETAIN(rp);
|
||||
IF_NO_GC([rp retain];)
|
||||
M_UNLOCK(myLock);
|
||||
NS_DURING
|
||||
{
|
||||
|
@ -1023,7 +1023,7 @@ static Class runLoopClass;
|
|||
|
||||
l = [runLoopClass currentRunLoop];
|
||||
|
||||
RETAIN(self);
|
||||
IF_NO_GC([self retain];)
|
||||
|
||||
[l addEvent: (void*)(uintptr_t)desc
|
||||
type: ET_WDESC
|
||||
|
@ -1137,7 +1137,7 @@ static void clean_up_sockets(void)
|
|||
unlink([name bytes]);
|
||||
}
|
||||
NSEndMapTableEnumeration(&mEnum);
|
||||
DESTROY(arp);
|
||||
IF_NO_GC(DESTROY(arp);)
|
||||
if (unknownThread == YES)
|
||||
{
|
||||
GSUnregisterCurrentThread();
|
||||
|
@ -1334,7 +1334,7 @@ typedef struct {
|
|||
else
|
||||
{
|
||||
RELEASE(theName);
|
||||
RETAIN(port);
|
||||
IF_NO_GC([port retain];)
|
||||
NSDebugMLLog(@"NSMessagePort", @"Using pre-existing port: %@", port);
|
||||
}
|
||||
IF_NO_GC(AUTORELEASE(port));
|
||||
|
@ -1454,7 +1454,7 @@ typedef struct {
|
|||
{
|
||||
if ((NSPort*) [handle recvPort] == recvPort)
|
||||
{
|
||||
RETAIN(handle);
|
||||
IF_NO_GC([handle retain];)
|
||||
NSEndMapTableEnumeration(&me);
|
||||
M_UNLOCK(myLock);
|
||||
return AUTORELEASE(handle);
|
||||
|
@ -1573,7 +1573,7 @@ typedef struct {
|
|||
{
|
||||
if ([self isValid] == YES)
|
||||
{
|
||||
RETAIN(self);
|
||||
IF_NO_GC([self retain];)
|
||||
M_LOCK(myLock);
|
||||
|
||||
if ([self isValid] == YES)
|
||||
|
@ -1709,7 +1709,7 @@ typedef struct {
|
|||
|
||||
- (void) removeHandle: (GSMessageHandle*)handle
|
||||
{
|
||||
RETAIN(self);
|
||||
IF_NO_GC([self retain];)
|
||||
M_LOCK(myLock);
|
||||
if ([handle sendPort] == self)
|
||||
{
|
||||
|
@ -1722,7 +1722,7 @@ typedef struct {
|
|||
* been retained - we must therefore release this port since the
|
||||
* handle no longer uses it.
|
||||
*/
|
||||
AUTORELEASE(self);
|
||||
IF_NO_GC([self autorelease];)
|
||||
}
|
||||
handle->sendPort = nil;
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ static void clean_up_names(void)
|
|||
[defaultServer removePort: port];
|
||||
}
|
||||
NSEndMapTableEnumeration(&mEnum);
|
||||
DESTROY(arp);
|
||||
IF_NO_GC(DESTROY(arp);)
|
||||
if (unknownThread == YES)
|
||||
{
|
||||
GSUnregisterCurrentThread();
|
||||
|
@ -206,7 +206,7 @@ static void clean_up_names(void)
|
|||
data = [GSMimeDocument encodeBase64: data];
|
||||
name = [[NSString alloc] initWithData: data
|
||||
encoding: NSASCIIStringEncoding];
|
||||
AUTORELEASE(name);
|
||||
IF_NO_GC([name autorelease];)
|
||||
}
|
||||
[serverLock lock];
|
||||
if (!base_path)
|
||||
|
|
|
@ -102,17 +102,17 @@
|
|||
{
|
||||
NSNumberFormatter *c = (NSNumberFormatter*) NSCopyObject(self, 0, zone);
|
||||
|
||||
RETAIN(c->_negativeFormat);
|
||||
RETAIN(c->_positiveFormat);
|
||||
RETAIN(c->_attributesForPositiveValues);
|
||||
RETAIN(c->_attributesForNegativeValues);
|
||||
RETAIN(c->_maximum);
|
||||
RETAIN(c->_minimum);
|
||||
RETAIN(c->_roundingBehavior);
|
||||
RETAIN(c->_roundingBehavior);
|
||||
RETAIN(c->_attributedStringForNil);
|
||||
RETAIN(c->_attributedStringForNotANumber);
|
||||
RETAIN(c->_attributedStringForZero);
|
||||
IF_NO_GC(RETAIN(c->_negativeFormat);)
|
||||
IF_NO_GC(RETAIN(c->_positiveFormat);)
|
||||
IF_NO_GC(RETAIN(c->_attributesForPositiveValues);)
|
||||
IF_NO_GC(RETAIN(c->_attributesForNegativeValues);)
|
||||
IF_NO_GC(RETAIN(c->_maximum);)
|
||||
IF_NO_GC(RETAIN(c->_minimum);)
|
||||
IF_NO_GC(RETAIN(c->_roundingBehavior);)
|
||||
IF_NO_GC(RETAIN(c->_roundingBehavior);)
|
||||
IF_NO_GC(RETAIN(c->_attributedStringForNil);)
|
||||
IF_NO_GC(RETAIN(c->_attributedStringForNotANumber);)
|
||||
IF_NO_GC(RETAIN(c->_attributedStringForZero);)
|
||||
|
||||
return c;
|
||||
}
|
||||
|
|
|
@ -123,6 +123,7 @@ BOOL NSDeallocateZombies = NO;
|
|||
static Class zombieClass;
|
||||
static NSMapTable zombieMap;
|
||||
|
||||
#if !GS_WITH_GC
|
||||
static void GSMakeZombie(NSObject *o)
|
||||
{
|
||||
Class c = ((id)o)->class_pointer;
|
||||
|
@ -141,6 +142,7 @@ static void GSMakeZombie(NSObject *o)
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void GSLogZombie(id o, SEL sel)
|
||||
{
|
||||
|
@ -384,7 +386,7 @@ typedef struct obj_layout *obj;
|
|||
|
||||
#include "GNUstepBase/GSIMap.h"
|
||||
|
||||
static GSIMapTable_t retain_counts = {0};
|
||||
IF_NO_GC(static GSIMapTable_t retain_counts = {0};)
|
||||
|
||||
#endif /* !defined(REFCNT_LOCAL) */
|
||||
|
||||
|
@ -701,7 +703,7 @@ NSAllocateObject(Class aClass, unsigned extraBytes, NSZone *zone)
|
|||
}
|
||||
else if ([aClass requiresTypedMemory])
|
||||
{
|
||||
new = GC_CALLOC_EXPLICTLY_TYPED(1, size, gc_type);
|
||||
new = GC_calloc_explicitly_typed(1, size, gc_type);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -2116,6 +2116,6 @@ if (domainMask & mask) \
|
|||
}
|
||||
}
|
||||
|
||||
AUTORELEASE (paths);
|
||||
IF_NO_GC(AUTORELEASE (paths);)
|
||||
return paths;
|
||||
}
|
||||
|
|
|
@ -365,7 +365,7 @@ static IMP _xRefImp; /* Serialize a crossref. */
|
|||
|
||||
coder = [self allocWithZone: NSDefaultMallocZone()];
|
||||
coder = [coder initWithReceivePort: recv sendPort: send components: comp];
|
||||
AUTORELEASE(coder);
|
||||
IF_NO_GC(AUTORELEASE(coder);)
|
||||
return coder;
|
||||
}
|
||||
|
||||
|
|
|
@ -991,7 +991,7 @@ int main(int argc, char *argv[], char *env[])
|
|||
pid = [self processIdentifier];
|
||||
start = (unsigned long)GSTimeNow();
|
||||
host = [[self hostName] stringByReplacingString: @"." withString: @"_"];
|
||||
RETAIN(host);
|
||||
IF_NO_GC(RETAIN(host);)
|
||||
}
|
||||
count = counter++;
|
||||
[gnustep_global_lock unlock];
|
||||
|
|
|
@ -1384,8 +1384,7 @@ nodeToObject(GSXMLNode* node, NSPropertyListMutabilityOptions o, NSString **e)
|
|||
}
|
||||
}
|
||||
}
|
||||
RETAIN(result);
|
||||
RELEASE(arp);
|
||||
IF_NO_GC([result retain]; [arp release];)
|
||||
return AUTORELEASE(result);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -203,7 +203,7 @@
|
|||
if (sig == nil)
|
||||
{
|
||||
sig = [NSMethodSignature signatureWithObjCTypes: "@@::"];
|
||||
RETAIN(sig);
|
||||
IF_NO_GC(RETAIN(sig);)
|
||||
}
|
||||
return sig;
|
||||
}
|
||||
|
|
|
@ -1047,11 +1047,7 @@ static inline BOOL timerInvalidated(NSTimer *t)
|
|||
|
||||
RELEASE(arp);
|
||||
|
||||
if (when != nil)
|
||||
{
|
||||
AUTORELEASE(when);
|
||||
}
|
||||
else
|
||||
if (when == nil)
|
||||
{
|
||||
GSIArray watchers = context->watchers;
|
||||
unsigned i = GSIArrayCount(watchers);
|
||||
|
@ -1070,6 +1066,12 @@ static inline BOOL timerInvalidated(NSTimer *t)
|
|||
when = theFuture;
|
||||
}
|
||||
}
|
||||
#if !GS_WITH_GC
|
||||
else
|
||||
{
|
||||
AUTORELEASE(when);
|
||||
}
|
||||
#endif
|
||||
|
||||
NSDebugMLLog(@"NSRunLoop", @"limit date %f in %@",
|
||||
[when timeIntervalSinceReferenceDate], mode);
|
||||
|
|
|
@ -684,7 +684,7 @@ deserializeFromInfo(_NSDeserializerInfo* info)
|
|||
* rather than simply releasing as the key may
|
||||
* be referred to by a cross-reference later.
|
||||
*/
|
||||
AUTORELEASE(k);
|
||||
IF_NO_GC(AUTORELEASE(k);)
|
||||
RELEASE(o);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1074,7 +1074,7 @@ static Class NSMutableSet_concrete_class;
|
|||
}
|
||||
else
|
||||
{
|
||||
RETAIN(other); // In case it's held by us
|
||||
IF_NO_GC([other retain];) // In case it's held by us
|
||||
[self removeAllObjects];
|
||||
[self unionSet: other];
|
||||
RELEASE(other);
|
||||
|
|
|
@ -1076,7 +1076,7 @@ static Class runLoopClass;
|
|||
DESTROY(rItems);
|
||||
NSDebugMLLog(@"GSTcpHandle",
|
||||
@"got message %@ on 0x%x", pm, self);
|
||||
RETAIN(rp);
|
||||
IF_NO_GC(RETAIN(rp);)
|
||||
M_UNLOCK(myLock);
|
||||
NS_DURING
|
||||
{
|
||||
|
@ -1353,7 +1353,7 @@ static Class runLoopClass;
|
|||
|
||||
l = [runLoopClass currentRunLoop];
|
||||
|
||||
RETAIN(self);
|
||||
IF_NO_GC(RETAIN(self);)
|
||||
|
||||
#if defined(__MINGW32__)
|
||||
NSAssert(event != WSA_INVALID_EVENT, @"Socket without win32 event!");
|
||||
|
@ -1754,7 +1754,7 @@ static Class tcpPortClass;
|
|||
}
|
||||
else
|
||||
{
|
||||
RETAIN(port);
|
||||
IF_NO_GC(RETAIN(port);)
|
||||
NSDebugMLLog(@"NSPort", @"Using pre-existing port: %@", port);
|
||||
}
|
||||
IF_NO_GC(AUTORELEASE(port));
|
||||
|
@ -1938,7 +1938,7 @@ static Class tcpPortClass;
|
|||
{
|
||||
if ((NSPort*) [handle recvPort] == recvPort)
|
||||
{
|
||||
RETAIN(handle);
|
||||
IF_NO_GC(RETAIN(handle);)
|
||||
NSEndMapTableEnumeration(&me);
|
||||
M_UNLOCK(myLock);
|
||||
return AUTORELEASE(handle);
|
||||
|
@ -2060,7 +2060,7 @@ static Class tcpPortClass;
|
|||
{
|
||||
if ([self isValid] == YES)
|
||||
{
|
||||
RETAIN(self);
|
||||
IF_NO_GC(RETAIN(self);)
|
||||
M_LOCK(myLock);
|
||||
|
||||
if ([self isValid] == YES)
|
||||
|
@ -2254,7 +2254,7 @@ static Class tcpPortClass;
|
|||
*/
|
||||
- (void) removeHandle: (GSTcpHandle*)handle
|
||||
{
|
||||
RETAIN(self);
|
||||
IF_NO_GC(RETAIN(self);)
|
||||
M_LOCK(myLock);
|
||||
if ([handle sendPort] == self)
|
||||
{
|
||||
|
@ -2267,7 +2267,7 @@ static Class tcpPortClass;
|
|||
* been retained - we must therefore release this port since the
|
||||
* handle no longer uses it.
|
||||
*/
|
||||
AUTORELEASE(self);
|
||||
IF_NO_GC(AUTORELEASE(self);)
|
||||
}
|
||||
handle->sendPort = nil;
|
||||
}
|
||||
|
|
|
@ -1195,7 +1195,7 @@ typedef enum {
|
|||
NSMutableSet *known = (NSMutableSet*)NSMapGet(_portMap, port);
|
||||
NSString *name;
|
||||
|
||||
RETAIN(known);
|
||||
IF_NO_GC(RETAIN(known);)
|
||||
while ((name = [known anyObject]) != nil)
|
||||
{
|
||||
if ([self removePortForName: name] == NO)
|
||||
|
|
|
@ -122,7 +122,7 @@ GSSpellServerName(NSString *vendor, NSString *language)
|
|||
connection = [[NSConnection alloc] init];
|
||||
if (connection)
|
||||
{
|
||||
RETAIN(connection);
|
||||
IF_NO_GC(RETAIN(connection);)
|
||||
[connection setRootObject: self];
|
||||
result = [connection registerName: serverName];
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ GSSpellServerName(NSString *vendor, NSString *language)
|
|||
- (void) setDelegate: (id)anObject
|
||||
{
|
||||
/* FIXME - we should not retain the delegate ! */
|
||||
RETAIN(anObject);
|
||||
IF_NO_GC(RETAIN(anObject);)
|
||||
ASSIGN(_delegate, anObject);
|
||||
}
|
||||
|
||||
|
|
|
@ -1485,7 +1485,7 @@ handle_printf_atsign (FILE *stream,
|
|||
length: dpos
|
||||
encoding: NSASCIIStringEncoding];
|
||||
NSZoneFree(NSDefaultMallocZone(), dst);
|
||||
AUTORELEASE(s);
|
||||
IF_NO_GC([s autorelease];)
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
@ -2553,7 +2553,7 @@ handle_printf_atsign (FILE *stream,
|
|||
}
|
||||
m = [d mutableCopy];
|
||||
[m appendBytes: "" length: 1];
|
||||
AUTORELEASE(m);
|
||||
IF_NO_GC([m autorelease];)
|
||||
return (const char*)[m bytes];
|
||||
}
|
||||
|
||||
|
@ -2589,7 +2589,7 @@ handle_printf_atsign (FILE *stream,
|
|||
{
|
||||
[m appendBytes: "" length: 1];
|
||||
}
|
||||
AUTORELEASE(m);
|
||||
IF_NO_GC([m autorelease];)
|
||||
return (const char*)[m bytes];
|
||||
}
|
||||
|
||||
|
@ -2636,7 +2636,7 @@ handle_printf_atsign (FILE *stream,
|
|||
allowLossyConversion: YES];
|
||||
m = [d mutableCopy];
|
||||
[m appendBytes: "" length: 1];
|
||||
AUTORELEASE(m);
|
||||
IF_NO_GC([m autorelease];)
|
||||
return (const char*)[m bytes];
|
||||
}
|
||||
|
||||
|
@ -2654,7 +2654,7 @@ handle_printf_atsign (FILE *stream,
|
|||
allowLossyConversion: NO];
|
||||
m = [d mutableCopy];
|
||||
[m appendBytes: "" length: 1];
|
||||
AUTORELEASE(m);
|
||||
IF_NO_GC([m autorelease];)
|
||||
return (const char*)[m bytes];
|
||||
}
|
||||
|
||||
|
|
|
@ -1278,7 +1278,7 @@ GSPrivateCheckTasks()
|
|||
|
||||
[tasksLock lock];
|
||||
t = (NSTask*)NSMapGet(activeTasks, (void*)(intptr_t)result);
|
||||
AUTORELEASE(RETAIN(t));
|
||||
IF_NO_GC(AUTORELEASE(RETAIN(t));)
|
||||
[tasksLock unlock];
|
||||
if (t != nil)
|
||||
{
|
||||
|
|
|
@ -834,7 +834,7 @@ pthread_detach(pthread_self());
|
|||
|
||||
/* The thread must persist until it finishes executing.
|
||||
*/
|
||||
RETAIN(self);
|
||||
IF_NO_GC(RETAIN(self);)
|
||||
|
||||
/* Mark the thread as active whiul it's running.
|
||||
*/
|
||||
|
|
|
@ -1432,14 +1432,16 @@ static NSMapTable *absolutes = 0;
|
|||
{
|
||||
tzdir = [tzdir stringByDeletingLastPathComponent];
|
||||
}
|
||||
if ([tzdir length] > 2)
|
||||
{
|
||||
RETAIN(tzdir);
|
||||
}
|
||||
else
|
||||
if ([tzdir length] <= 2)
|
||||
{
|
||||
localZoneString = tzdir = nil;
|
||||
}
|
||||
#if !GS_WITH_GC
|
||||
else
|
||||
{
|
||||
[tzdir retain];
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
if (localZoneString != nil && [localZoneString hasPrefix: tzdir])
|
||||
|
@ -1621,7 +1623,7 @@ static NSMapTable *absolutes = 0;
|
|||
to be in this directory, but initWithName:data:
|
||||
will do this anyway and log a message if not. */
|
||||
zone = [[self alloc] initWithName: name data: data];
|
||||
AUTORELEASE(zone);
|
||||
IF_NO_GC([zone autorelease];)
|
||||
}
|
||||
if (zone != nil)
|
||||
{
|
||||
|
|
|
@ -1651,7 +1651,7 @@ static unsigned urlAlign;
|
|||
if (c != 0)
|
||||
{
|
||||
handle = [[c alloc] initWithURL: self cached: shouldUseCache];
|
||||
AUTORELEASE(handle);
|
||||
IF_NO_GC([handle autorelease];)
|
||||
}
|
||||
}
|
||||
return handle;
|
||||
|
@ -1734,7 +1734,7 @@ static unsigned urlAlign;
|
|||
{
|
||||
id c = clientForHandle(_clients, sender);
|
||||
|
||||
RETAIN(self);
|
||||
IF_NO_GC([self retain];)
|
||||
[sender removeClient: self];
|
||||
if (c != nil)
|
||||
{
|
||||
|
|
|
@ -252,10 +252,10 @@ static Class NSURLHandleClass = 0;
|
|||
{
|
||||
id o = client;
|
||||
|
||||
RETAIN(o);
|
||||
IF_NO_GC([o retain];)
|
||||
[_clients removeObjectIdenticalTo: o];
|
||||
[_clients addObject: o];
|
||||
RELEASE(o);
|
||||
IF_NO_GC([o release];)
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -312,12 +312,12 @@ static Class NSURLHandleClass = 0;
|
|||
*/
|
||||
- (void) cancelLoadInBackground
|
||||
{
|
||||
RETAIN(self);
|
||||
IF_NO_GC([self retain];)
|
||||
[_clients makeObjectsPerformSelector:
|
||||
@selector(URLHandleResourceDidCancelLoading:)
|
||||
withObject: self];
|
||||
[self endLoadInBackground];
|
||||
RELEASE(self);
|
||||
IF_NO_GC([self release];)
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
|
@ -631,7 +631,7 @@ static NSLock *fileLock = nil;
|
|||
NS_DURING
|
||||
{
|
||||
obj = [fileCache objectForKey: path];
|
||||
AUTORELEASE(RETAIN(obj));
|
||||
IF_NO_GC([[obj retain] autorelease];)
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
|
@ -723,7 +723,7 @@ static NSLock *fileLock = nil;
|
|||
if (obj != nil)
|
||||
{
|
||||
DESTROY(self);
|
||||
RETAIN(obj);
|
||||
IF_NO_GC([obj retain];)
|
||||
}
|
||||
}
|
||||
NS_HANDLER
|
||||
|
|
|
@ -664,8 +664,10 @@ static NSURLProtocol *placeholder = nil;
|
|||
nil]]];
|
||||
return;
|
||||
}
|
||||
RETAIN(this->input);
|
||||
RETAIN(this->output);
|
||||
#if !GS_WITH_GC
|
||||
[this->input retain];
|
||||
[this->output retain];
|
||||
#endif
|
||||
if ([[url scheme] isEqualToString: @"https"] == YES)
|
||||
{
|
||||
[this->input setProperty: NSStreamSocketSecurityLevelNegotiatedSSL
|
||||
|
@ -1153,7 +1155,7 @@ static NSURLProtocol *placeholder = nil;
|
|||
{
|
||||
/* Make sure no action triggered by anything else destroys us prematurely.
|
||||
*/
|
||||
AUTORELEASE(RETAIN(self));
|
||||
IF_NO_GC([[self retain] autorelease];)
|
||||
|
||||
#if 0
|
||||
NSLog(@"stream: %@ handleEvent: %x for: %@", stream, event, self);
|
||||
|
@ -1451,8 +1453,10 @@ static NSURLProtocol *placeholder = nil;
|
|||
userInfo: nil]];
|
||||
return;
|
||||
}
|
||||
RETAIN(this->input);
|
||||
RETAIN(this->output);
|
||||
#if !GS_WITH_GC
|
||||
[this->input retain];
|
||||
[this->output retain];
|
||||
#endif
|
||||
if ([[url scheme] isEqualToString: @"https"] == YES)
|
||||
{
|
||||
[this->input setProperty: NSStreamSocketSecurityLevelNegotiatedSSL
|
||||
|
|
|
@ -279,7 +279,7 @@ typedef struct {
|
|||
p = AUTORELEASE([GSMimeParser new]);
|
||||
h = [[GSMimeHeader alloc] initWithName: @"content-displosition"
|
||||
value: disp];
|
||||
AUTORELEASE(h);
|
||||
IF_NO_GC([h autorelease];)
|
||||
sc = [NSScanner scannerWithString: [h value]];
|
||||
if ([p scanHeaderBody: sc into: h] == YES)
|
||||
{
|
||||
|
|
|
@ -449,7 +449,7 @@ static BOOL setSharedDefaults = NO; /* Flag to prevent infinite recursion */
|
|||
*/
|
||||
if (setSharedDefaults == YES)
|
||||
{
|
||||
RETAIN(sharedDefaults);
|
||||
IF_NO_GC([sharedDefaults retain];)
|
||||
[classLock unlock];
|
||||
return AUTORELEASE(sharedDefaults);
|
||||
}
|
||||
|
@ -628,7 +628,7 @@ static BOOL setSharedDefaults = NO; /* Flag to prevent infinite recursion */
|
|||
/* FIXME - should we set this as volatile domain for English ? */
|
||||
[sharedDefaults registerDefaults: [self _unlocalizedDefaults]];
|
||||
}
|
||||
RETAIN(sharedDefaults);
|
||||
IF_NO_GC([sharedDefaults retain];)
|
||||
updateCache(sharedDefaults);
|
||||
[classLock unlock];
|
||||
return AUTORELEASE(sharedDefaults);
|
||||
|
@ -1024,7 +1024,7 @@ static BOOL setSharedDefaults = NO; /* Flag to prevent infinite recursion */
|
|||
if (dict != nil && (object = [dict objectForKey: defaultName]))
|
||||
break;
|
||||
}
|
||||
RETAIN(object);
|
||||
IF_NO_GC([object retain];)
|
||||
[_lock unlock];
|
||||
return AUTORELEASE(object);
|
||||
}
|
||||
|
|
|
@ -91,7 +91,7 @@ static GSLazyLock *lock = nil;
|
|||
|
||||
[lock lock];
|
||||
transformer = [registry objectForKey: name];
|
||||
RETAIN(transformer);
|
||||
IF_NO_GC([transformer retain];)
|
||||
[lock unlock];
|
||||
return AUTORELEASE(transformer);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue