From 6516be5735b5f03099a90af23b99f9ab7cf2fa93 Mon Sep 17 00:00:00 2001 From: rfm Date: Wed, 4 Feb 2009 17:41:19 +0000 Subject: [PATCH] explicitly use collectable memory git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@27784 72102866-910b-0410-8b05-ffd578937521 --- Source/NSNotificationCenter.m | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/Source/NSNotificationCenter.m b/Source/NSNotificationCenter.m index 559b43dfb..ddc7bc451 100644 --- a/Source/NSNotificationCenter.m +++ b/Source/NSNotificationCenter.m @@ -313,8 +313,13 @@ static GSIMapTable mapNew(NCTable *t) { GSIMapTable m; +#if GS_WITH_GC + m = NSAllocateCollectable(sizeof(GSIMapTable_t), NSScannedOption); + GSIMapInitWithZoneAndCapacity(m, GSIMapStrongKeyAndVal, 2); +#else m = NSZoneMalloc(_zone, sizeof(GSIMapTable_t)); GSIMapInitWithZoneAndCapacity(m, _zone, 2); +#endif return m; } } @@ -400,15 +405,23 @@ static NCTable *newNCTable(void) { NCTable *t; +#if GS_WITH_GC + t = (NCTable*)NSAllocateCollectable(sizeof(NCTable), NSScannedOption); +#else t = (NCTable*)NSZoneMalloc(_zone, sizeof(NCTable)); memset((void*)t, '\0', sizeof(NCTable)); +#endif t->chunkIndex = CHUNKSIZE; t->wildcard = ENDOBS; +#if GS_WITH_GC + t->nameless = NSAllocateCollectable(sizeof(GSIMapTable_t), NSScannedOption); + t->named = NSAllocateCollectable(sizeof(GSIMapTable_t), NSScannedOption); +#else t->nameless = NSZoneMalloc(_zone, sizeof(GSIMapTable_t)); - GSIMapInitWithZoneAndCapacity(t->nameless, _zone, 16); - t->named = NSZoneMalloc(_zone, sizeof(GSIMapTable_t)); +#endif + GSIMapInitWithZoneAndCapacity(t->nameless, _zone, 16); GSIMapInitWithZoneAndCapacity(t->named, _zone, 128); // t->_lock = [GSLazyRecursiveLock new];