mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 00:30:53 +00:00
cleanup changes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@39762 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
97d38ffc0c
commit
71941dd24d
14 changed files with 198 additions and 746 deletions
|
@ -27,105 +27,6 @@
|
|||
#import "Foundation/NSGarbageCollector.h"
|
||||
|
||||
static NSGarbageCollector *collector = nil;
|
||||
|
||||
#if __OBJC_GC__
|
||||
#include <objc/objc-auto.h>
|
||||
|
||||
id CFRetain(id obj)
|
||||
{
|
||||
if (collector)
|
||||
{
|
||||
return objc_gc_retain(obj);
|
||||
}
|
||||
return [obj retain];
|
||||
}
|
||||
|
||||
void CFRelease(id obj)
|
||||
{
|
||||
if (collector)
|
||||
{
|
||||
objc_gc_release(obj);
|
||||
}
|
||||
else
|
||||
{
|
||||
[obj release];
|
||||
}
|
||||
}
|
||||
|
||||
@implementation NSGarbageCollector
|
||||
|
||||
+ (id) defaultCollector
|
||||
{
|
||||
return collector;
|
||||
}
|
||||
|
||||
+ (void) initialize
|
||||
{
|
||||
if (objc_collecting_enabled())
|
||||
{
|
||||
collector = [self alloc];
|
||||
objc_startCollectorThread();
|
||||
}
|
||||
}
|
||||
|
||||
- (void) collectIfNeeded
|
||||
{
|
||||
objc_collect(OBJC_COLLECT_IF_NEEDED | OBJC_FULL_COLLECTION);
|
||||
}
|
||||
|
||||
- (void) collectExhaustively
|
||||
{
|
||||
objc_collect(OBJC_EXHAUSTIVE_COLLECTION);
|
||||
}
|
||||
|
||||
- (void) disable
|
||||
{
|
||||
objc_gc_disable();
|
||||
}
|
||||
|
||||
- (void) disableCollectorForPointer: (void *)ptr
|
||||
{
|
||||
CFRetain(ptr);
|
||||
}
|
||||
|
||||
- (void) enable
|
||||
{
|
||||
objc_gc_enable();
|
||||
}
|
||||
|
||||
- (void) enableCollectorForPointer: (void *)ptr
|
||||
{
|
||||
CFRelease(ptr);
|
||||
}
|
||||
|
||||
- (id) init
|
||||
{
|
||||
if (self != collector)
|
||||
{
|
||||
[self release];
|
||||
self = collector;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (BOOL) isCollecting
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL) isEnabled
|
||||
{
|
||||
return objc_collectingEnabled();
|
||||
}
|
||||
|
||||
- (NSZone*) zone
|
||||
{
|
||||
return NSDefaultMallocZone();
|
||||
}
|
||||
@end
|
||||
|
||||
#else
|
||||
|
||||
static unsigned disabled = 0;
|
||||
|
||||
@implementation NSGarbageCollector
|
||||
|
@ -195,4 +96,3 @@ static unsigned disabled = 0;
|
|||
}
|
||||
@end
|
||||
|
||||
#endif // __OBJC_GC__
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue