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:
Richard Frith-MacDonald 2009-01-12 12:48:46 +00:00
parent 43ad91f79e
commit 952af9c197
65 changed files with 707 additions and 214 deletions

View file

@ -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

View file

@ -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

View file

@ -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;

View file

@ -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
{

View file

@ -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
{