mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 08:41:03 +00:00
improve allocation
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@14254 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
1cac195ffb
commit
035082da71
1 changed files with 8 additions and 2 deletions
|
@ -31,19 +31,25 @@
|
|||
|
||||
@implementation NSNotification
|
||||
|
||||
static Class abstractClass = 0;
|
||||
static Class concreteClass = 0;
|
||||
|
||||
@class GSNotification;
|
||||
|
||||
+ (NSNotification*) allocWithZone: (NSZone*)z
|
||||
{
|
||||
return (id)NSAllocateObject(concreteClass, 0, z);
|
||||
if (self == abstractClass)
|
||||
{
|
||||
return (id)NSAllocateObject(concreteClass, 0, z);
|
||||
}
|
||||
return (id)NSAllocateObject(self, 0, z);
|
||||
}
|
||||
|
||||
+ (void) initialize
|
||||
{
|
||||
if (concreteClass == 0)
|
||||
{
|
||||
abstractClass = [NSNotification class];
|
||||
concreteClass = [GSNotification class];
|
||||
}
|
||||
}
|
||||
|
@ -95,7 +101,7 @@ static Class concreteClass = 0;
|
|||
|
||||
- (id) init
|
||||
{
|
||||
if ([self class] == [NSNotification class])
|
||||
if ([self class] == abstractClass)
|
||||
{
|
||||
NSZone *z = [self zone];
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue