mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
Tidyup for GC
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@4956 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
11ef04f603
commit
18f87db0c7
30 changed files with 137 additions and 111 deletions
28
ChangeLog
28
ChangeLog
|
@ -1,3 +1,31 @@
|
|||
Tue Sep 28 20:54:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
|
||||
* Source/NSArray.m: Tidy for GC stuff
|
||||
* Source/NSAttributedString.m: ditto
|
||||
* Source/NSCallBacks.m: ditto
|
||||
* Source/NSConnection.m: ditto
|
||||
* Source/NSData.m: ditto
|
||||
* Source/NSDateFormatter.m: ditto
|
||||
* Source/NSFileManager.m: ditto
|
||||
* Source/NSGArray.m: ditto
|
||||
* Source/NSGCountedSet.m: ditto
|
||||
* Source/NSGDictionary.m: ditto
|
||||
* Source/NSGSet.m: ditto
|
||||
* Source/NSInvocation.m: ditto
|
||||
* Source/NSNotificationCenter.m: ditto
|
||||
* Source/NSObject.m: ditto
|
||||
* Source/NSPortNameServer.m: ditto
|
||||
* Source/NSProcessInfo.m: ditto
|
||||
* Source/NSRunLoop.m: ditto
|
||||
* Source/NSScanner.m: ditto
|
||||
* Source/NSString.m: ditto
|
||||
* Source/NSTimeZone.m: ditto
|
||||
* Source/NSUnarchiver.m: ditto
|
||||
* Source/NSUndoManager.m: ditto
|
||||
* Source/NSUserDefaults.m: ditto
|
||||
* Source/TcpPort.m: ditto
|
||||
* Source/propList.h: ditto
|
||||
|
||||
Tue Sep 28 11:45:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
|
||||
* Source/NSArray.m: ([+allocWithZone:]) tiny optimisation.
|
||||
|
|
|
@ -127,11 +127,7 @@ GSIArrayGrow(GSIArray array)
|
|||
|
||||
next = array->cap + array->old;
|
||||
size = next*sizeof(GSIArrayItem);
|
||||
#if GS_WITH_GC
|
||||
tmp = (GSIArrayItem*)GC_REALLOC(size);
|
||||
#else
|
||||
tmp = NSZoneRealloc(array->zone, array->ptr, size);
|
||||
#endif
|
||||
|
||||
if (tmp == 0)
|
||||
{
|
||||
|
@ -372,11 +368,7 @@ GSIArrayClear(GSIArray array)
|
|||
{
|
||||
if (array->ptr)
|
||||
{
|
||||
#if GS_WITH_GC
|
||||
GC_FREE((void*)array->ptr);
|
||||
#else
|
||||
NSZoneFree(array->zone, (void*)array->ptr);
|
||||
#endif
|
||||
array->ptr = 0;
|
||||
array->cap = 0;
|
||||
}
|
||||
|
|
|
@ -717,11 +717,7 @@ GSIMapEmptyMap(GSIMapTable map)
|
|||
{
|
||||
for (i = 0; i < map->chunkCount; i++)
|
||||
{
|
||||
#if GS_WITH_GC
|
||||
GC_FREE(map->nodeChunks[i]);
|
||||
#else
|
||||
NSZoneFree(map->zone, map->nodeChunks[i]);
|
||||
#endif
|
||||
}
|
||||
map->chunkCount = 0;
|
||||
NSZoneFree(map->zone, map->nodeChunks);
|
||||
|
|
|
@ -260,6 +260,8 @@ extern NSRecursiveLock *gnustep_global_lock;
|
|||
#define CREATE_AUTORELEASE_POOL(X)
|
||||
#endif
|
||||
|
||||
#define IF_NO_GC(X)
|
||||
|
||||
#else
|
||||
|
||||
/*
|
||||
|
@ -296,17 +298,18 @@ extern NSRecursiveLock *gnustep_global_lock;
|
|||
#ifndef ASSIGN
|
||||
#define ASSIGN(object,value) ({\
|
||||
id __value = (id)(value); \
|
||||
if (__value != (id)object) \
|
||||
id __object = (id)(object); \
|
||||
if (__value != __object) \
|
||||
{ \
|
||||
if (__value) \
|
||||
object = __value; \
|
||||
if (__value != nil) \
|
||||
{ \
|
||||
[__value retain]; \
|
||||
} \
|
||||
if (object) \
|
||||
if (__object != nil) \
|
||||
{ \
|
||||
[(id)object release]; \
|
||||
[__object release]; \
|
||||
} \
|
||||
(id)object = __value; \
|
||||
} \
|
||||
})
|
||||
#endif
|
||||
|
@ -334,16 +337,19 @@ if (__value != (id)object) \
|
|||
#endif
|
||||
|
||||
/*
|
||||
* DESTROY() is a release operation which also sets the object to be
|
||||
* DESTROY() is a release operation which also sets the variable to be
|
||||
* a nil pointer for tidyness - we can't accidentally use a DESTROYED
|
||||
* object later.
|
||||
* object later. It also makes sure to set the variable to nil before
|
||||
* releasing the object - to avoid side-effects of the release trying
|
||||
* to reference the object being released through the variable.
|
||||
*/
|
||||
#ifndef DESTROY
|
||||
#define DESTROY(object) ({ \
|
||||
if (object) \
|
||||
{ \
|
||||
[object release]; \
|
||||
id __o = object; \
|
||||
object = nil; \
|
||||
[__o release]; \
|
||||
} \
|
||||
})
|
||||
#endif
|
||||
|
@ -353,6 +359,8 @@ if (__value != (id)object) \
|
|||
NSAutoreleasePool *(X) = [NSAutoreleasePool new]
|
||||
#endif
|
||||
|
||||
#define IF_NO_GC(X) X
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* __NSObject_h_GNUSTEP_BASE_INCLUDE */
|
||||
|
|
|
@ -71,7 +71,6 @@ extern NSZone* __nszone_private_hidden_default_zone;
|
|||
|
||||
extern NSZone* __nszone_private_hidden_atomic_zone;
|
||||
|
||||
#define
|
||||
extern inline NSZone* NSCreateZone (size_t start, size_t gran, BOOL canFree)
|
||||
{ return __nszone_private_hidden_default_zone; }
|
||||
|
||||
|
@ -79,7 +78,7 @@ extern inline NSZone* NSDefaultMallocZone (void)
|
|||
{ return __nszone_private_hidden_default_zone; }
|
||||
|
||||
extern inline NSZone* GSAtomicMallocZone (void)
|
||||
{ return __nszone_private_hidden_atomict_zone; }
|
||||
{ return __nszone_private_hidden_atomic_zone; }
|
||||
|
||||
extern inline NSZone* NSZoneFromPointer (void *ptr)
|
||||
{ return __nszone_private_hidden_default_zone; }
|
||||
|
@ -89,9 +88,9 @@ extern inline void* NSZoneMalloc (NSZone *zone, size_t size)
|
|||
void *ptr;
|
||||
|
||||
if (zone == GSAtomicMallocZone())
|
||||
*ptr = (void*)GC_MALLOC_ATOMIC(size);
|
||||
ptr = (void*)GC_MALLOC_ATOMIC(size);
|
||||
else
|
||||
*ptr = (void*)GC_MALLOC(size);
|
||||
ptr = (void*)GC_MALLOC(size);
|
||||
|
||||
if (ptr == 0)
|
||||
ptr = GSOutOfMemory(size, YES);
|
||||
|
@ -104,12 +103,12 @@ extern inline void* NSZoneCalloc (NSZone *zone, size_t elems, size_t bytes)
|
|||
void *ptr;
|
||||
|
||||
if (zone == __nszone_private_hidden_atomic_zone)
|
||||
*ptr = (void*)GC_MALLOC_ATOMIC(size);
|
||||
ptr = (void*)GC_MALLOC_ATOMIC(size);
|
||||
else
|
||||
*ptr = (void*)GC_MALLOC(size);
|
||||
ptr = (void*)GC_MALLOC(size);
|
||||
|
||||
if (ptr == 0)
|
||||
ptr = GSOutOfMemory(size);
|
||||
ptr = GSOutOfMemory(size, NO);
|
||||
memset(ptr, '\0', size);
|
||||
return ptr;
|
||||
}
|
||||
|
@ -144,7 +143,7 @@ extern inline NSString* NSZoneName (NSZone *zone)
|
|||
|
||||
extern inline void* NSZoneMallocAtomic (NSZone *zone, size_t size)
|
||||
{
|
||||
return NSZoneMalloc(GSAtomicmallocZone(), size);
|
||||
return NSZoneMalloc(GSAtomicMallocZone(), size);
|
||||
}
|
||||
|
||||
extern inline BOOL NSZoneCheck (NSZone *zone)
|
||||
|
|
|
@ -1143,7 +1143,7 @@ static NSString *indentStrings[] = {
|
|||
id b = [self objectAtIndex: d];
|
||||
if ((*compare)(a, b, context) == NSOrderedAscending)
|
||||
{
|
||||
RETAIN(a);
|
||||
IF_NO_GC(RETAIN(a));
|
||||
[self replaceObjectAtIndex: d + stride withObject: b];
|
||||
[self replaceObjectAtIndex: d withObject: a];
|
||||
RELEASE(a);
|
||||
|
@ -1175,7 +1175,7 @@ static NSString *indentStrings[] = {
|
|||
{
|
||||
[super init];
|
||||
array = anArray;
|
||||
RETAIN(array);
|
||||
IF_NO_GC(RETAIN(array));
|
||||
pos = 0;
|
||||
get = [array methodForSelector: oaiSel];
|
||||
cnt = (unsigned (*)(NSArray*, SEL))[array methodForSelector: countSel];
|
||||
|
|
|
@ -401,7 +401,7 @@ static Class NSMutableAttributedString_concrete_class;
|
|||
RELEASE(m);
|
||||
}
|
||||
|
||||
AUTORELEASE(newAttrString);
|
||||
IF_NO_GC(AUTORELEASE(newAttrString));
|
||||
return newAttrString;
|
||||
}
|
||||
|
||||
|
@ -453,7 +453,7 @@ static Class NSMutableAttributedString_concrete_class;
|
|||
effectiveRange = NSIntersectionRange(aRange,effectiveRange);
|
||||
|
||||
newDict = [[NSMutableDictionary alloc] initWithDictionary: attrDict];
|
||||
AUTORELEASE(newDict);
|
||||
IF_NO_GC(AUTORELEASE(newDict));
|
||||
[newDict setObject: value forKey: name];
|
||||
[self setAttributes: newDict range: effectiveRange];
|
||||
|
||||
|
@ -495,7 +495,7 @@ static Class NSMutableAttributedString_concrete_class;
|
|||
effectiveRange = NSIntersectionRange(aRange,effectiveRange);
|
||||
|
||||
newDict = [[NSMutableDictionary alloc] initWithDictionary: attrDict];
|
||||
AUTORELEASE(newDict);
|
||||
IF_NO_GC(AUTORELEASE(newDict));
|
||||
[newDict addEntriesFromDictionary: attributes];
|
||||
[self setAttributes: newDict range: effectiveRange];
|
||||
|
||||
|
@ -527,7 +527,7 @@ static Class NSMutableAttributedString_concrete_class;
|
|||
effectiveRange = NSIntersectionRange(aRange,effectiveRange);
|
||||
|
||||
newDict = [[NSMutableDictionary alloc] initWithDictionary: attrDict];
|
||||
AUTORELEASE(newDict);
|
||||
IF_NO_GC(AUTORELEASE(newDict));
|
||||
[newDict removeObjectForKey: name];
|
||||
[self setAttributes: newDict range: effectiveRange];
|
||||
|
||||
|
|
|
@ -149,7 +149,7 @@ _NS_id_is_equal (void *table, id <NSObject> o, id <NSObject> p)
|
|||
void
|
||||
_NS_id_retain (void *table, id <NSObject> o)
|
||||
{
|
||||
RETAIN(o);
|
||||
IF_NO_GC(RETAIN(o));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -479,7 +479,7 @@ static int messages_received_count;
|
|||
|
||||
[proxiesHashGate lock];
|
||||
targets = NSAllMapTableValues(local_targets);
|
||||
RETAIN(targets);
|
||||
IF_NO_GC(RETAIN(targets));
|
||||
for (i = 0; i < [targets count]; i++)
|
||||
{
|
||||
id t = [[targets objectAtIndex: i] localForProxy];
|
||||
|
|
|
@ -599,7 +599,7 @@ failure:
|
|||
if ([mgr fileExistsAtPath: path])
|
||||
{
|
||||
att = [[mgr fileAttributesAtPath:path traverseLink:YES] mutableCopy];
|
||||
TEST_AUTORELEASE(att);
|
||||
IF_NO_GC(TEST_AUTORELEASE(att));
|
||||
}
|
||||
|
||||
c = rename(thePath, theRealPath);
|
||||
|
@ -702,7 +702,7 @@ failure:
|
|||
d = [d initWithBytesNoCopy: *(void**)data
|
||||
length: len
|
||||
fromZone: z];
|
||||
AUTORELEASE(d);
|
||||
IF_NO_GC(AUTORELEASE(d));
|
||||
}
|
||||
|
||||
[self deserializeBytes: *(char**)data
|
||||
|
@ -772,7 +772,7 @@ failure:
|
|||
d = [d initWithBytesNoCopy: *(void**)data
|
||||
length: len
|
||||
fromZone: z];
|
||||
AUTORELEASE(d);
|
||||
IF_NO_GC(AUTORELEASE(d));
|
||||
[self deserializeDataAt: *(char**)data
|
||||
ofObjCType: type
|
||||
atCursor: cursor
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
{
|
||||
NSDateFormatter *other = (id)NSCopyObject(self, 0, zone);
|
||||
|
||||
RETAIN(other->_dateFormat);
|
||||
IF_NO_GC(RETAIN(other->_dateFormat));
|
||||
return other;
|
||||
}
|
||||
|
||||
|
|
|
@ -544,10 +544,10 @@ static NSFileManager* defaultManager = nil;
|
|||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
CREATE_AUTORELEASE_POOL(arp);
|
||||
NSString *item;
|
||||
NSString *next;
|
||||
BOOL result;
|
||||
CREATE_AUTORELEASE_POOL(arp);
|
||||
|
||||
item = [contents objectAtIndex: i];
|
||||
next = [path stringByAppendingPathComponent: item];
|
||||
|
@ -673,10 +673,10 @@ static NSFileManager* defaultManager = nil;
|
|||
|
||||
for (index = 0; ok == YES && index < [a1 count]; index++)
|
||||
{
|
||||
CREATE_AUTORELEASE_POOL(pool);
|
||||
NSString *n = [a1 objectAtIndex: index];
|
||||
NSString *p1;
|
||||
NSString *p2;
|
||||
CREATE_AUTORELEASE_POOL(pool);
|
||||
|
||||
p1 = [path1 stringByAppendingPathComponent: n];
|
||||
p2 = [path2 stringByAppendingPathComponent: n];
|
||||
|
@ -1342,7 +1342,7 @@ static NSFileManager* defaultManager = nil;
|
|||
_directoryAttributes = [[NSFileManager defaultManager]
|
||||
fileAttributesAtPath: _topPath
|
||||
traverseLink: _flags.isFollowing];
|
||||
RETAIN(_directoryAttributes);
|
||||
IF_NO_GC(RETAIN(_directoryAttributes));
|
||||
}
|
||||
return _directoryAttributes;
|
||||
}
|
||||
|
@ -1354,7 +1354,7 @@ static NSFileManager* defaultManager = nil;
|
|||
_fileAttributes = [[NSFileManager defaultManager]
|
||||
fileAttributesAtPath: _currentFilePath
|
||||
traverseLink: _flags.isFollowing];
|
||||
RETAIN(_fileAttributes);
|
||||
IF_NO_GC(RETAIN(_fileAttributes));
|
||||
}
|
||||
return _fileAttributes;
|
||||
}
|
||||
|
|
|
@ -432,7 +432,9 @@ static SEL eqSel = @selector(isEqual:);
|
|||
{
|
||||
if ((*imp)(anObject, eqSel, _contents_array[index]) == YES)
|
||||
{
|
||||
#if GS_WITH_GC == 0
|
||||
id obj = _contents_array[index];
|
||||
#endif
|
||||
unsigned pos = index;
|
||||
|
||||
while (++pos < _count)
|
||||
|
@ -474,7 +476,9 @@ static SEL eqSel = @selector(isEqual:);
|
|||
{
|
||||
if (_contents_array[index] == anObject)
|
||||
{
|
||||
#if GS_WITH_GC == 0
|
||||
id obj = _contents_array[index];
|
||||
#endif
|
||||
unsigned pos = index;
|
||||
|
||||
while (++pos < _count)
|
||||
|
@ -502,7 +506,7 @@ static SEL eqSel = @selector(isEqual:);
|
|||
* array in case a retain or release causes an exception.
|
||||
*/
|
||||
obj = _contents_array[index];
|
||||
RETAIN(anObject);
|
||||
IF_NO_GC(RETAIN(anObject));
|
||||
_contents_array[index] = anObject;
|
||||
RELEASE(obj);
|
||||
}
|
||||
|
@ -581,7 +585,7 @@ static SEL eqSel = @selector(isEqual:);
|
|||
{
|
||||
[super init];
|
||||
array = anArray;
|
||||
RETAIN(array);
|
||||
IF_NO_GC(RETAIN(array));
|
||||
pos = 0;
|
||||
return self;
|
||||
}
|
||||
|
|
|
@ -170,7 +170,7 @@
|
|||
|
||||
if (objs[i] == nil)
|
||||
{
|
||||
AUTORELEASE(self);
|
||||
IF_NO_GC(AUTORELEASE(self));
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"Tried to init counted set with nil value"];
|
||||
}
|
||||
|
|
|
@ -212,13 +212,13 @@ myEqual(id self, id other)
|
|||
|
||||
if (keys[i] == nil)
|
||||
{
|
||||
AUTORELEASE(self);
|
||||
IF_NO_GC(AUTORELEASE(self));
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"Tried to init dictionary with nil key"];
|
||||
}
|
||||
if (objs[i] == nil)
|
||||
{
|
||||
AUTORELEASE(self);
|
||||
IF_NO_GC(AUTORELEASE(self));
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"Tried to init dictionary with nil value"];
|
||||
}
|
||||
|
@ -226,7 +226,7 @@ myEqual(id self, id other)
|
|||
node = GSIMapNodeForKey(&map, (GSIMapKey)keys[i]);
|
||||
if (node)
|
||||
{
|
||||
RETAIN(objs[i]);
|
||||
IF_NO_GC(RETAIN(objs[i]));
|
||||
RELEASE(node->value.obj);
|
||||
node->value.obj = objs[i];
|
||||
}
|
||||
|
@ -267,7 +267,7 @@ myEqual(id self, id other)
|
|||
k = [k copyWithZone: z];
|
||||
if (k == nil)
|
||||
{
|
||||
AUTORELEASE(self);
|
||||
IF_NO_GC(AUTORELEASE(self));
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"Tried to init dictionary with nil key"];
|
||||
}
|
||||
|
@ -281,7 +281,7 @@ myEqual(id self, id other)
|
|||
}
|
||||
if (o == nil)
|
||||
{
|
||||
AUTORELEASE(self);
|
||||
IF_NO_GC(AUTORELEASE(self));
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"Tried to init dictionary with nil value"];
|
||||
}
|
||||
|
@ -364,7 +364,7 @@ myEqual(id self, id other)
|
|||
node = GSIMapNodeForKey(&map, (GSIMapKey)aKey);
|
||||
if (node)
|
||||
{
|
||||
RETAIN(anObject);
|
||||
IF_NO_GC(RETAIN(anObject));
|
||||
RELEASE(node->value.obj);
|
||||
node->value.obj = anObject;
|
||||
}
|
||||
|
|
|
@ -164,7 +164,7 @@
|
|||
|
||||
if (objs[i] == nil)
|
||||
{
|
||||
AUTORELEASE(self);
|
||||
IF_NO_GC(AUTORELEASE(self));
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"Tried to init set with nil value"];
|
||||
}
|
||||
|
|
|
@ -163,7 +163,7 @@
|
|||
|
||||
mframe_get_arg(_argframe, &_info[i], &old);
|
||||
mframe_set_arg(_argframe, &_info[i], buffer);
|
||||
RETAIN(*(id*)buffer);
|
||||
IF_NO_GC(RETAIN(*(id*)buffer));
|
||||
if (old != nil)
|
||||
{
|
||||
RELEASE(old);
|
||||
|
@ -258,7 +258,7 @@
|
|||
int i;
|
||||
|
||||
_argsRetained = YES;
|
||||
RETAIN(_target);
|
||||
IF_NO_GC(RETAIN(_target));
|
||||
if (_argframe == 0)
|
||||
{
|
||||
return;
|
||||
|
@ -274,7 +274,7 @@
|
|||
mframe_get_arg(_argframe, &_info[i], &old);
|
||||
if (old != nil)
|
||||
{
|
||||
RETAIN(old);
|
||||
IF_NO_GC(RETAIN(old));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -563,7 +563,7 @@
|
|||
*(id*)datum = va_arg (ap, id);
|
||||
if (_argsRetained)
|
||||
{
|
||||
RETAIN(*(id*)datum);
|
||||
IF_NO_GC(RETAIN(*(id*)datum));
|
||||
}
|
||||
break;
|
||||
case _C_CHARPTR:
|
||||
|
|
|
@ -135,8 +135,8 @@ static void obsFree(Observation *o);
|
|||
#include <base/GSIArray.h>
|
||||
|
||||
#define GSI_MAP_RETAIN_KEY(X)
|
||||
#define GSI_MAP_RELEASE_KEY(X) ((((gsaddr)X.obj) & 1) == 0 \
|
||||
? RELEASE(X.obj) : X.obj)
|
||||
#define GSI_MAP_RELEASE_KEY(X) ({if ((((gsaddr)X.obj) & 1) == 0) \
|
||||
RELEASE(X.obj);})
|
||||
#define GSI_MAP_HASH(X) doHash(X.obj)
|
||||
#define GSI_MAP_EQUAL(X,Y) doEqual(X.obj, Y.obj)
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include <Foundation/NSPortCoder.h>
|
||||
#include <Foundation/NSDistantObject.h>
|
||||
#include <Foundation/NSZone.h>
|
||||
#include <Foundation/NSDebug.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include <base/fast.x>
|
||||
|
@ -478,15 +479,19 @@ static BOOL double_release_check_enabled = NO;
|
|||
{
|
||||
// Create the global lock
|
||||
gnustep_global_lock = [[NSRecursiveLock alloc] init];
|
||||
#if !defined(REFCNT_LOCAL)
|
||||
autorelease_class = [NSAutoreleasePool class];
|
||||
autorelease_imp = [autorelease_class methodForSelector: autorelease_sel];
|
||||
fastMallocClass = [_FastMallocBuffer class];
|
||||
#if GS_WITH_GC == 0
|
||||
#if !defined(REFCNT_LOCAL)
|
||||
retain_counts = o_map_with_callbacks (o_callbacks_for_non_owned_void_p,
|
||||
o_callbacks_for_int);
|
||||
retain_counts_gate = objc_mutex_allocate ();
|
||||
#endif
|
||||
autorelease_class = [NSAutoreleasePool class];
|
||||
autorelease_imp = [autorelease_class methodForSelector: autorelease_sel];
|
||||
fastMallocClass = [_FastMallocBuffer class];
|
||||
fastMallocOffset = fastMallocClass->instance_size % ALIGN;
|
||||
#else
|
||||
fastMallocOffset = 0;
|
||||
#endif
|
||||
_fastBuildCache();
|
||||
}
|
||||
return;
|
||||
|
|
|
@ -397,7 +397,7 @@ typedef enum {
|
|||
if (state == GSPC_FAIL)
|
||||
return;
|
||||
|
||||
RETAIN(handle);
|
||||
IF_NO_GC(RETAIN(handle));
|
||||
nc = [NSNotificationCenter defaultCenter];
|
||||
[nc addObserver: self
|
||||
selector: @selector(didConnect:)
|
||||
|
@ -431,7 +431,7 @@ typedef enum {
|
|||
msg.port = 0;
|
||||
TEST_RELEASE(data);
|
||||
data = [NSMutableData dataWithBytes: (void*)&msg length: sizeof(msg)];
|
||||
RETAIN(data);
|
||||
IF_NO_GC(RETAIN(data));
|
||||
[self open: nil];
|
||||
}
|
||||
|
||||
|
@ -444,7 +444,7 @@ typedef enum {
|
|||
[name getCString: msg.name];
|
||||
TEST_RELEASE(data);
|
||||
data = [NSMutableData dataWithBytes: (void*)&msg length: sizeof(msg)];
|
||||
RETAIN(data);
|
||||
IF_NO_GC(RETAIN(data));
|
||||
[self open: host];
|
||||
}
|
||||
|
||||
|
@ -457,7 +457,7 @@ typedef enum {
|
|||
msg.port = GSSwapHostI32ToBig(portNumber);
|
||||
TEST_RELEASE(data);
|
||||
data = [NSMutableData dataWithBytes: (void*)&msg length: sizeof(msg)];
|
||||
RETAIN(data);
|
||||
IF_NO_GC(RETAIN(data));
|
||||
[self open: nil];
|
||||
}
|
||||
|
||||
|
@ -477,7 +477,7 @@ typedef enum {
|
|||
msg.port = GSSwapHostI32ToBig(portNumber);
|
||||
TEST_RELEASE(data);
|
||||
data = [NSMutableData dataWithBytes: (void*)&msg length: sizeof(msg)];
|
||||
RETAIN(data);
|
||||
IF_NO_GC(RETAIN(data));
|
||||
[self open: nil];
|
||||
}
|
||||
|
||||
|
|
|
@ -158,7 +158,7 @@ _gnu_process_args(int argc, char *argv[], char *env[])
|
|||
|
||||
/* Getting the process name */
|
||||
_gnu_processName = [[NSString stringWithCString: argv[0]] lastPathComponent];
|
||||
RETAIN(_gnu_processName);
|
||||
IF_NO_GC(RETAIN(_gnu_processName));
|
||||
|
||||
|
||||
/* Copy the argument list */
|
||||
|
|
|
@ -164,7 +164,7 @@ static inline BOOL timerInvalidated(NSTimer* timer)
|
|||
#define GSI_ARRAY_RETAIN(X) [(X).obj retain]
|
||||
#else
|
||||
#define GSI_ARRAY_RELEASE(X)
|
||||
#define GSI_ARRAY_RETAIN(X) (X).obj
|
||||
#define GSI_ARRAY_RETAIN(X)
|
||||
#endif
|
||||
|
||||
#include <base/GSIArray.h>
|
||||
|
@ -314,8 +314,8 @@ static NSComparisonResult aSort(GSIArrayItem i0, GSIArrayItem i1)
|
|||
{
|
||||
GSTimedPerformer *array[count];
|
||||
|
||||
RETAIN(target);
|
||||
RETAIN(arg);
|
||||
IF_NO_GC(RETAIN(target));
|
||||
IF_NO_GC(RETAIN(arg));
|
||||
[perf getObjects: array];
|
||||
while (count-- > 0)
|
||||
{
|
||||
|
@ -786,13 +786,13 @@ const NSMapTableValueCallBacks ArrayMapValueCallBacks =
|
|||
|
||||
- (NSDate*) limitDateForMode: (NSString*)mode
|
||||
{
|
||||
CREATE_AUTORELEASE_POOL(arp);
|
||||
id saved_mode;
|
||||
NSDate *when;
|
||||
GSIArray timers;
|
||||
GSIArray watchers;
|
||||
NSTimer *min_timer = nil;
|
||||
GSRunLoopWatcher *min_watcher = nil;
|
||||
CREATE_AUTORELEASE_POOL(arp);
|
||||
|
||||
saved_mode = _current_mode;
|
||||
_current_mode = mode;
|
||||
|
@ -1011,7 +1011,6 @@ const NSMapTableValueCallBacks ArrayMapValueCallBacks =
|
|||
- (void) acceptInputForMode: (NSString*)mode
|
||||
beforeDate: limit_date
|
||||
{
|
||||
CREATE_AUTORELEASE_POOL(arp);
|
||||
NSTimeInterval ti;
|
||||
struct timeval timeout;
|
||||
void *select_timeout;
|
||||
|
@ -1023,6 +1022,7 @@ const NSMapTableValueCallBacks ArrayMapValueCallBacks =
|
|||
int fd_index;
|
||||
id saved_mode;
|
||||
int num_inputs = 0;
|
||||
CREATE_AUTORELEASE_POOL(arp);
|
||||
|
||||
NSAssert(mode, NSInvalidArgumentException);
|
||||
saved_mode = _current_mode;
|
||||
|
@ -1298,7 +1298,7 @@ const NSMapTableValueCallBacks ArrayMapValueCallBacks =
|
|||
* releases it.
|
||||
*/
|
||||
d = [d earlierDate: date];
|
||||
RETAIN(d);
|
||||
IF_NO_GC(RETAIN(d));
|
||||
|
||||
/* Wait, listening to our input sources. */
|
||||
[self acceptInputForMode: mode beforeDate: d];
|
||||
|
|
|
@ -75,7 +75,7 @@ typedef struct {
|
|||
if (self == [NSScanner class])
|
||||
{
|
||||
defaultSkipSet = [NSCharacterSet whitespaceAndNewlineCharacterSet];
|
||||
RETAIN(defaultSkipSet);
|
||||
IF_NO_GC(RETAIN(defaultSkipSet));
|
||||
NSString_class = [NSString class];
|
||||
NSGString_class = [NSGString class];
|
||||
NSGCString_class = [NSGCString class];
|
||||
|
|
|
@ -143,7 +143,7 @@ pathSeps()
|
|||
#else
|
||||
myPathSeps = [NSCharacterSet characterSetWithCharactersInString: @"/"];
|
||||
#endif
|
||||
RETAIN(myPathSeps);
|
||||
IF_NO_GC(RETAIN(myPathSeps));
|
||||
sepMember = (BOOL (*)(NSCharacterSet*, SEL, unichar))
|
||||
[myPathSeps methodForSelector: @selector(characterIsMember:)];
|
||||
}
|
||||
|
|
|
@ -424,7 +424,7 @@ static NSMapTable *absolutes = 0;
|
|||
z = (NSConcreteAbsoluteTimeZone*)NSMapGet(absolutes, (void*)(gsaddr)anOffset);
|
||||
if (z)
|
||||
{
|
||||
RETAIN(z);
|
||||
IF_NO_GC(RETAIN(z));
|
||||
RELEASE(self);
|
||||
}
|
||||
else
|
||||
|
@ -611,7 +611,7 @@ static NSMapTable *absolutes = 0;
|
|||
NSLog(@"Using time zone with absolute offset 0.");
|
||||
localTimeZone = [NSTimeZone timeZoneForSecondsFromGMT: 0];
|
||||
}
|
||||
RETAIN(localTimeZone);
|
||||
IF_NO_GC(RETAIN(localTimeZone));
|
||||
|
||||
fake_abbrev_dict = [[NSInternalAbbrevDict alloc] init];
|
||||
}
|
||||
|
|
|
@ -518,7 +518,7 @@ mapClassName(NSUnarchiverObjectInfo *info)
|
|||
* order to give the appearance that it's actually a
|
||||
* new object.
|
||||
*/
|
||||
RETAIN(obj);
|
||||
IF_NO_GC(RETAIN(obj));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -964,7 +964,7 @@ mapClassName(NSUnarchiverObjectInfo *info)
|
|||
d = [[NSData allocWithZone: zone] initWithBytesNoCopy: b
|
||||
length: l
|
||||
fromZone: zone];
|
||||
AUTORELEASE(d);
|
||||
IF_NO_GC(AUTORELEASE(d));
|
||||
[self decodeArrayOfObjCType: @encode(unsigned char)
|
||||
count: l
|
||||
at: b];
|
||||
|
|
|
@ -99,10 +99,7 @@ NSString *NSUndoManagerWillUndoChangeNotification =
|
|||
|
||||
- (void) orphan
|
||||
{
|
||||
id p = parent;
|
||||
|
||||
parent = nil;
|
||||
RELEASE(p);
|
||||
DESTROY(parent);
|
||||
}
|
||||
|
||||
- (PrivateUndoGroup*) parent
|
||||
|
@ -427,7 +424,7 @@ NSString *NSUndoManagerWillUndoChangeNotification =
|
|||
postNotificationName: NSUndoManagerWillRedoChangeNotification
|
||||
object: self];
|
||||
groupToRedo = [_redoStack objectAtIndex: [_redoStack count] - 1];
|
||||
RETAIN(groupToRedo);
|
||||
IF_NO_GC([groupToRedo retain]);
|
||||
[_redoStack removeObjectAtIndex: [_redoStack count] - 1];
|
||||
oldGroup = _group;
|
||||
_group = nil;
|
||||
|
@ -684,7 +681,7 @@ NSString *NSUndoManagerWillUndoChangeNotification =
|
|||
else
|
||||
{
|
||||
groupToUndo = [_undoStack objectAtIndex: [_undoStack count] - 1];
|
||||
RETAIN(groupToUndo);
|
||||
IF_NO_GC([groupToUndo retain]);
|
||||
[_undoStack removeObjectAtIndex: [_undoStack count] - 1];
|
||||
}
|
||||
[self beginUndoGrouping];
|
||||
|
|
|
@ -107,11 +107,8 @@ static BOOL setSharedDefaults = NO; /* Flag to prevent infinite recursion */
|
|||
|
||||
+ (void) resetUserDefaults
|
||||
{
|
||||
id defs = sharedDefaults;
|
||||
|
||||
setSharedDefaults = NO;
|
||||
sharedDefaults = nil;
|
||||
RELEASE(defs);
|
||||
DESTROY(sharedDefaults);
|
||||
}
|
||||
|
||||
+ (NSUserDefaults*) standardUserDefaults
|
||||
|
@ -328,25 +325,25 @@ static BOOL setSharedDefaults = NO; /* Flag to prevent infinite recursion */
|
|||
_defaultsDatabase = (NSMutableString*)[path mutableCopy];
|
||||
else
|
||||
{
|
||||
_defaultsDatabase =
|
||||
(NSMutableString*)[NSMutableString stringWithFormat: @"%@/%@",
|
||||
NSHomeDirectoryForUser(NSUserName()),
|
||||
GNU_UserDefaultsDatabase];
|
||||
RETAIN(_defaultsDatabase);
|
||||
_defaultsDatabase = (NSMutableString*)
|
||||
[NSMutableString stringWithFormat: @"%@/%@",
|
||||
NSHomeDirectoryForUser(NSUserName()),
|
||||
GNU_UserDefaultsDatabase];
|
||||
IF_NO_GC([_defaultsDatabase retain]);
|
||||
}
|
||||
|
||||
if ([[_defaultsDatabase lastPathComponent] isEqual:
|
||||
[GNU_UserDefaultsDatabase lastPathComponent]] == YES)
|
||||
_defaultsDatabaseLockName =
|
||||
(NSMutableString*)[NSMutableString stringWithFormat: @"%@/%@",
|
||||
[_defaultsDatabase stringByDeletingLastPathComponent],
|
||||
[GNU_UserDefaultsDatabaseLock lastPathComponent]];
|
||||
_defaultsDatabaseLockName = (NSMutableString*)
|
||||
[NSMutableString stringWithFormat: @"%@/%@",
|
||||
[_defaultsDatabase stringByDeletingLastPathComponent],
|
||||
[GNU_UserDefaultsDatabaseLock lastPathComponent]];
|
||||
else
|
||||
_defaultsDatabaseLockName =
|
||||
(NSMutableString*)[NSMutableString stringWithFormat: @"%@/%@",
|
||||
NSHomeDirectoryForUser(NSUserName()),
|
||||
GNU_UserDefaultsDatabaseLock];
|
||||
RETAIN(_defaultsDatabaseLockName);
|
||||
_defaultsDatabaseLockName = (NSMutableString*)
|
||||
[NSMutableString stringWithFormat: @"%@/%@",
|
||||
NSHomeDirectoryForUser(NSUserName()),
|
||||
GNU_UserDefaultsDatabaseLock];
|
||||
IF_NO_GC([_defaultsDatabaseLockName retain]);
|
||||
_defaultsDatabaseLock =
|
||||
RETAIN([NSDistributedLock lockWithPath: _defaultsDatabaseLockName]);
|
||||
}
|
||||
|
|
|
@ -219,7 +219,7 @@ static NSHashTable *tcpHandleTable = 0;
|
|||
handle->ports =
|
||||
NSCreateHashTable(NSNonRetainedObjectHashCallBacks, 0);
|
||||
NSHashInsert(tcpHandleTable, (void*)handle);
|
||||
AUTORELEASE(handle);
|
||||
IF_NO_GC(AUTORELEASE(handle));
|
||||
}
|
||||
}
|
||||
[tcpHandleLock unlock];
|
||||
|
@ -455,7 +455,7 @@ static GSTcpPort *dummyPort = nil;
|
|||
port->handles = NSCreateHashTable(NSObjectHashCallBacks, 0);
|
||||
NSMapInsert(thePorts, (void*)(gsaddr)sockaddr->sin_addr.s_addr,
|
||||
(void*)port);
|
||||
AUTORELEASE(port);
|
||||
IF_NO_GC(AUTORELEASE(port));
|
||||
}
|
||||
|
||||
if (port != nil && handle != nil)
|
||||
|
@ -672,7 +672,7 @@ static GSTcpPort *dummyPort = nil;
|
|||
}
|
||||
}
|
||||
}
|
||||
AUTORELEASE(port);
|
||||
IF_NO_GC(AUTORELEASE(port));
|
||||
}
|
||||
|
||||
[tcpPortLock unlock];
|
||||
|
|
|
@ -36,7 +36,7 @@ static void setupHexdigits()
|
|||
{
|
||||
hexdigits = [NSCharacterSet characterSetWithCharactersInString:
|
||||
@"0123456789abcdef"];
|
||||
RETAIN(hexdigits);
|
||||
IF_NO_GC(RETAIN(hexdigits));
|
||||
hexdigitsImp =
|
||||
(BOOL(*)(id,SEL,unichar)) [hexdigits methodForSelector: cMemberSel];
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ static void setupWhitespce()
|
|||
{
|
||||
whitespce = [NSCharacterSet characterSetWithCharactersInString:
|
||||
@" \t\r\n\f\b"];
|
||||
RETAIN(whitespce);
|
||||
IF_NO_GC(RETAIN(whitespce));
|
||||
whitespceImp =
|
||||
(BOOL(*)(id,SEL,unichar)) [whitespce methodForSelector: cMemberSel];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue