mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-17 01:11:45 +00:00
Add class versions of retain and friends.
As class objects don't have retain counts (they're usually static, even!!), allowing the instance implementations of retain, release, and autorelease attempt to modify the non-existant retainCount would be a recipe for severe headaches. We also don't want the retainCount returning "random" values.
This commit is contained in:
parent
6b46cde7c8
commit
07e67da838
2 changed files with 30 additions and 0 deletions
|
@ -64,6 +64,11 @@
|
|||
+ (void) poseAsClass: (Class)aClass;
|
||||
+ (Class) superclass;
|
||||
|
||||
+ (id) retain;
|
||||
+ (id) autorelease;
|
||||
+ (/*oneway*/ void) release;
|
||||
+ (unsigned) retainCount;
|
||||
|
||||
- (id) init;
|
||||
- (void) dealloc;
|
||||
- (void) doesNotRecognizeSelector: (SEL)aSelector;
|
||||
|
|
|
@ -306,6 +306,31 @@ BOOL (id object) object_is_meta_class = #0;
|
|||
{
|
||||
return obj_get_retaincount (self);
|
||||
}
|
||||
|
||||
/* The class implementations of autorelease, retain and release are dummy
|
||||
methods with no effect. They allow class objects to be stored in
|
||||
containers that send retain and release messages. Thus, the class
|
||||
implementation of retainCount always returns the maximum unsigned value.
|
||||
*/
|
||||
+ (id) autorelease
|
||||
{
|
||||
return self;
|
||||
}
|
||||
|
||||
+ (id) retain
|
||||
{
|
||||
return self;
|
||||
}
|
||||
|
||||
+ (/*oneway*/ void) release
|
||||
{
|
||||
}
|
||||
|
||||
+ (unsigned) retainCount
|
||||
{
|
||||
return UINT_MAX;
|
||||
}
|
||||
|
||||
/*
|
||||
CONVENIENCE METHODS
|
||||
|
||||
|
|
Loading…
Reference in a new issue