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:
Richard Frith-Macdonald 2002-08-09 07:51:11 +00:00
parent 1cac195ffb
commit 035082da71

View file

@ -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];