Optimize NSAutoreleasePool +new

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@3275 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 1998-11-20 13:44:59 +00:00
parent 3088258e10
commit fffedeff85
5 changed files with 18 additions and 6 deletions

View file

@ -93,10 +93,16 @@ pop_pool_from_cache (struct autorelease_thread_vars *tv)
@implementation NSAutoreleasePool
static IMP allocImp;
static IMP initImp;
+ (void) initialize
{
if (self == [NSAutoreleasePool class])
; // Anything to put here?
{
allocImp = [self methodForSelector: @selector(allocWithZone:)];
initImp = [self instanceMethodForSelector: @selector(init)];
}
}
+ allocWithZone: (NSZone*)zone
@ -110,6 +116,12 @@ pop_pool_from_cache (struct autorelease_thread_vars *tv)
return NSAllocateObject (self, 0, zone);
}
+ new
{
id arp = (*allocImp)(self, @selector(allocWithZone:), NSDefaultMallocZone());
return (*initImp)(arp, @selector(init));
}
- init
{
if (!_released_head)