mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 00:30:53 +00:00
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:
parent
cabb77a59f
commit
d53820760a
3 changed files with 21 additions and 4 deletions
|
@ -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>
|
||||
|
||||
* Source/include/NSThread.h: Update notification names to MacOS-X
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue