Added NSExtraRefCount()

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@4279 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 1999-05-21 18:14:48 +00:00
parent cabb77a59f
commit d53820760a
3 changed files with 21 additions and 4 deletions

View file

@ -1,3 +1,8 @@
Fri May 21 19:35:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* Source/include/NSObject.h: Added NSExtraRefCount()
* Source/NSObject.m: Added NSExtraRefCount()
Fri May 21 16:50:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk> Fri May 21 16:50:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* Source/include/NSThread.h: Update notification names to MacOS-X * Source/include/NSThread.h: Update notification names to MacOS-X

View file

@ -141,6 +141,7 @@ void NSDeallocateObject(NSObject *anObject);
NSObject *NSCopyObject(NSObject *anObject, unsigned extraBytes, NSZone *zone); NSObject *NSCopyObject(NSObject *anObject, unsigned extraBytes, NSZone *zone);
BOOL NSShouldRetainWithZone(NSObject *anObject, NSZone *requestedZone); BOOL NSShouldRetainWithZone(NSObject *anObject, NSZone *requestedZone);
unsigned NSExtraRefCount(id anObject);
void NSIncrementExtraRefCount(id anObject); void NSIncrementExtraRefCount(id anObject);
BOOL NSDecrementExtraRefCountWasZero(id anObject); BOOL NSDecrementExtraRefCountWasZero(id anObject);

View file

@ -148,6 +148,11 @@ typedef struct obj_layout *obj;
#if GS_WITH_GC #if GS_WITH_GC
unsigned
NSExtraRefCount(id anObject)
{
return 0;
}
void void
NSIncrementExtraRefCount(id anObject) NSIncrementExtraRefCount(id anObject)
{ {
@ -167,6 +172,12 @@ NSDecrementExtraRefCountWasZero(id anObject)
* depending on whether we are using local or global counting. * depending on whether we are using local or global counting.
*/ */
#if defined(REFCNT_LOCAL) #if defined(REFCNT_LOCAL)
unsigned
NSExtraRefCount(id anObject)
{
return ((obj)anObject)[-1].retained;
}
void void
NSIncrementExtraRefCount(id anObject) NSIncrementExtraRefCount(id anObject)
{ {
@ -188,7 +199,7 @@ NSDecrementExtraRefCountWasZero(id anObject)
#define NSDecrementExtraRefCountWasZero(X) \ #define NSDecrementExtraRefCountWasZero(X) \
(((obj)(X))[-1].retained-- == 0 ? YES : NO) (((obj)(X))[-1].retained-- == 0 ? YES : NO)
#define extraRefCount(X) (((obj)(X))[-1].retained) #define NSExtraRefCount(X) (((obj)(X))[-1].retained)
#else #else
@ -233,8 +244,8 @@ NSDecrementExtraRefCountWasZero (id anObject)
return NO; return NO;
} }
static unsigned unsigned
extraRefCount (id anObject) NSExtraRefCount (id anObject)
{ {
unsigned ret; unsigned ret;
@ -922,7 +933,7 @@ static BOOL double_release_check_enabled = NO;
#if GS_WITH_GC #if GS_WITH_GC
return UINT_MAX; return UINT_MAX;
#else #else
return extraRefCount(self) + 1; return NSExtraRefCount(self) + 1;
#endif #endif
} }