mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 00:11:26 +00:00
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:
parent
3088258e10
commit
fffedeff85
5 changed files with 18 additions and 6 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue