mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
More optimisation - remove objc overhead in adding object to pool.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@4216 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
1dbd6cc410
commit
6eeac88fe0
1 changed files with 3 additions and 4 deletions
|
@ -127,6 +127,8 @@ static IMP initImp;
|
|||
{
|
||||
if (!_released_head)
|
||||
{
|
||||
addImp = (void (*)(id, SEL, id))
|
||||
[self methodForSelector: @selector(addObject:)];
|
||||
/* Allocate the array that will be the new head of the list of arrays. */
|
||||
_released = (struct autorelease_array_list*)
|
||||
objc_malloc (sizeof(struct autorelease_array_list) +
|
||||
|
@ -226,9 +228,8 @@ static IMP initImp;
|
|||
{
|
||||
NSAutoreleasePool *pool = ARP_THREAD_VARS->current_pool;
|
||||
|
||||
NSAssert(anObj, NSInvalidArgumentException);
|
||||
if (pool)
|
||||
[pool addObject: anObj];
|
||||
(*pool->addImp)(pool, @selector(addObject:), anObj);
|
||||
else
|
||||
{
|
||||
NSAutoreleasePool *arp = [NSAutoreleasePool new];
|
||||
|
@ -244,7 +245,6 @@ NSAssert(anObj, NSInvalidArgumentException);
|
|||
|
||||
- (void) addObject: anObj
|
||||
{
|
||||
NSAssert(anObj, NSInvalidArgumentException);
|
||||
/* If the global, static variable AUTORELEASE_ENABLED is not set,
|
||||
do nothing, just return. */
|
||||
if (!autorelease_enabled)
|
||||
|
@ -345,7 +345,6 @@ NSAssert(anObj, NSInvalidArgumentException);
|
|||
@"to check for release errors."];
|
||||
#endif
|
||||
released->objects[i] = nil;
|
||||
NSAssert(anObject, NSInternalInconsistencyException);
|
||||
[anObject release];
|
||||
}
|
||||
released->count = 0;
|
||||
|
|
Loading…
Reference in a new issue