From d53820760a040c00087eba19564db0a174d631a3 Mon Sep 17 00:00:00 2001 From: Richard Frith-MacDonald Date: Fri, 21 May 1999 18:14:48 +0000 Subject: [PATCH] Added NSExtraRefCount() git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@4279 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 5 +++++ Headers/gnustep/base/NSObject.h | 1 + Source/NSObject.m | 19 +++++++++++++++---- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index f64ba63bb..9270b5bde 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Fri May 21 19:35:00 1999 Richard Frith-Macdonald + + * Source/include/NSObject.h: Added NSExtraRefCount() + * Source/NSObject.m: Added NSExtraRefCount() + Fri May 21 16:50:00 1999 Richard Frith-Macdonald * Source/include/NSThread.h: Update notification names to MacOS-X diff --git a/Headers/gnustep/base/NSObject.h b/Headers/gnustep/base/NSObject.h index 63d8f8490..9c5ba5cff 100644 --- a/Headers/gnustep/base/NSObject.h +++ b/Headers/gnustep/base/NSObject.h @@ -141,6 +141,7 @@ void NSDeallocateObject(NSObject *anObject); NSObject *NSCopyObject(NSObject *anObject, unsigned extraBytes, NSZone *zone); BOOL NSShouldRetainWithZone(NSObject *anObject, NSZone *requestedZone); +unsigned NSExtraRefCount(id anObject); void NSIncrementExtraRefCount(id anObject); BOOL NSDecrementExtraRefCountWasZero(id anObject); diff --git a/Source/NSObject.m b/Source/NSObject.m index fea32067b..ba7823789 100644 --- a/Source/NSObject.m +++ b/Source/NSObject.m @@ -148,6 +148,11 @@ typedef struct obj_layout *obj; #if GS_WITH_GC +unsigned +NSExtraRefCount(id anObject) +{ + return 0; +} void NSIncrementExtraRefCount(id anObject) { @@ -167,6 +172,12 @@ NSDecrementExtraRefCountWasZero(id anObject) * depending on whether we are using local or global counting. */ #if defined(REFCNT_LOCAL) +unsigned +NSExtraRefCount(id anObject) +{ + return ((obj)anObject)[-1].retained; +} + void NSIncrementExtraRefCount(id anObject) { @@ -188,7 +199,7 @@ NSDecrementExtraRefCountWasZero(id anObject) #define NSDecrementExtraRefCountWasZero(X) \ (((obj)(X))[-1].retained-- == 0 ? YES : NO) -#define extraRefCount(X) (((obj)(X))[-1].retained) +#define NSExtraRefCount(X) (((obj)(X))[-1].retained) #else @@ -233,8 +244,8 @@ NSDecrementExtraRefCountWasZero (id anObject) return NO; } -static unsigned -extraRefCount (id anObject) +unsigned +NSExtraRefCount (id anObject) { unsigned ret; @@ -922,7 +933,7 @@ static BOOL double_release_check_enabled = NO; #if GS_WITH_GC return UINT_MAX; #else - return extraRefCount(self) + 1; + return NSExtraRefCount(self) + 1; #endif }