From 035082da710b1e05a419e313e5f3a58d9eb3055a Mon Sep 17 00:00:00 2001 From: Richard Frith-Macdonald Date: Fri, 9 Aug 2002 07:51:11 +0000 Subject: [PATCH] improve allocation git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@14254 72102866-910b-0410-8b05-ffd578937521 --- Source/NSNotification.m | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Source/NSNotification.m b/Source/NSNotification.m index 10d52f77e..67531d994 100644 --- a/Source/NSNotification.m +++ b/Source/NSNotification.m @@ -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];