ftp.nice.ch/Attic/openStep/developer/resources/MiscKit.2.0.5.s.gnutar.gz#/MiscKit2/Temp/MiscObject.m

This is MiscObject.m in view mode; [Download] [Up]

/*
 * MiscObject
 *
 * General root class for all foundation objects of the framework
 *
 * This class implements its own reference counting scheme,
 * which is much faster than the one implemented by NSObject.
 * (minimum factor 10)
 * This is because NSObject uses a hashtable and we use simply
 * an instance variable. The little more memory used by this
 * implementation should be no problem today.
 *
 * Written by Ingo Feulner for Cube Informationssysteme GmbH.
 *
 * TODO: Debug options as implemented by NSObject.
 */
#import "MiscObject.h"

@implementation MiscObject

+ alloc
{
	return [self allocWithZone:NULL];
}

+ allocWithZone:(NSZone *)zone
{
        MiscObject *theObject;              

        theObject = (MiscObject *)NSAllocateObject([self class], 0, zone);
        theObject->_retainCount = 1;

        return theObject;
}

- retain
{
	_retainCount++;
	return self;
}

- (unsigned int)retainCount
{
	return _retainCount;
}

- (oneway void)release
{
	if(!--_retainCount)
		[self dealloc];
}

@end

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.