mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-25 17:51:01 +00:00
Reduce internal class interdependency for improved maintainability.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@32083 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
7dcf69abbb
commit
6f4f708a6f
2 changed files with 19 additions and 13 deletions
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
* Source/NSKeyValueObserving.m: Recommit
|
* Source/NSKeyValueObserving.m: Recommit
|
||||||
Reviewed and tested.
|
Reviewed and tested.
|
||||||
|
* Source/NAutoreleasePool.m: Make +initialize do nothing so that it
|
||||||
|
won't interfere with anythign else when called by [NSObject+initialize]
|
||||||
|
|
||||||
2011-02-11 Richard Frith-Macdonald <rfm@gnu.org>
|
2011-02-11 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
|
|
@ -111,22 +111,15 @@ pop_pool_from_cache (struct autorelease_thread_vars *tv)
|
||||||
return tv->pool_cache[--(tv->pool_cache_count)];
|
return tv->pool_cache[--(tv->pool_cache_count)];
|
||||||
}
|
}
|
||||||
|
|
||||||
static SEL releaseSel = 0;
|
|
||||||
|
|
||||||
|
|
||||||
@implementation NSAutoreleasePool
|
@implementation NSAutoreleasePool
|
||||||
|
|
||||||
static IMP allocImp;
|
|
||||||
static IMP initImp;
|
|
||||||
|
|
||||||
+ (void) initialize
|
+ (void) initialize
|
||||||
{
|
{
|
||||||
if (self == [NSAutoreleasePool class])
|
/* Do nothing here which might interact with ther classes since this
|
||||||
{
|
* is called by [NSObject+initialize] !
|
||||||
releaseSel = @selector(release);
|
*/
|
||||||
allocImp = [self methodForSelector: @selector(allocWithZone:)];
|
return;
|
||||||
initImp = [self instanceMethodForSelector: @selector(init)];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (id) allocWithZone: (NSZone*)zone
|
+ (id) allocWithZone: (NSZone*)zone
|
||||||
|
@ -140,7 +133,18 @@ static IMP initImp;
|
||||||
|
|
||||||
+ (id) new
|
+ (id) new
|
||||||
{
|
{
|
||||||
id arp = (*allocImp)(self, @selector(allocWithZone:), NSDefaultMallocZone());
|
static IMP allocImp = 0;
|
||||||
|
static IMP initImp = 0;
|
||||||
|
id arp;
|
||||||
|
|
||||||
|
if (0 == allocImp)
|
||||||
|
{
|
||||||
|
allocImp
|
||||||
|
= [NSAutoreleasePool methodForSelector: @selector(allocWithZone:)];
|
||||||
|
initImp
|
||||||
|
= [NSAutoreleasePool instanceMethodForSelector: @selector(init)];
|
||||||
|
}
|
||||||
|
arp = (*allocImp)(self, @selector(allocWithZone:), NSDefaultMallocZone());
|
||||||
return (*initImp)(arp, @selector(init));
|
return (*initImp)(arp, @selector(init));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -438,7 +442,7 @@ static IMP initImp;
|
||||||
imps[hash] = get_imp(c, @selector(release));
|
imps[hash] = get_imp(c, @selector(release));
|
||||||
classes[hash] = c;
|
classes[hash] = c;
|
||||||
}
|
}
|
||||||
(imps[hash])(anObject, releaseSel);
|
(imps[hash])(anObject, @selector(release));
|
||||||
}
|
}
|
||||||
_released_count -= released->count;
|
_released_count -= released->count;
|
||||||
released->count = 0;
|
released->count = 0;
|
||||||
|
|
Loading…
Reference in a new issue