minor fixups to last lot of GC changes

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@27786 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2009-02-04 20:19:27 +00:00
parent 356720376a
commit 9b44e4c7c5
3 changed files with 26 additions and 5 deletions

View file

@ -157,8 +157,11 @@ NSCopyHashTableWithZone(NSHashTable *table, NSZone *zone)
#if GS_WITH_GC
zone = GSIMapStrongKeyAndVal;
#endif
t = (GSIMapTable)NSAllocateCollectable(sizeof(GSIMapTable_t),
NSScannedOption);
#else
t = (GSIMapTable)NSZoneMalloc(zone, sizeof(GSIMapTable_t));
#endif
GSIMapInitWithZoneAndCapacity(t, zone, ((GSIMapTable)table)->nodeCount);
t->extra = ((GSIMapTable)table)->extra;
enumerator = GSIMapEnumeratorForMap((GSIMapTable)table);
@ -218,8 +221,11 @@ NSCreateHashTableWithZone(
#if GS_WITH_GC
zone = GSIMapStrongKeyAndVal;
#endif
table = (GSIMapTable)NSAllocateCollectable(sizeof(GSIMapTable_t),
NSScannedOption);
#else
table = (GSIMapTable)NSZoneMalloc(zone, sizeof(GSIMapTable_t));
#endif
GSIMapInitWithZoneAndCapacity(table, zone, capacity);
table->extra = callBacks;

View file

@ -209,8 +209,11 @@ NSCopyMapTableWithZone(NSMapTable *table, NSZone *zone)
#if GS_WITH_GC
zone = GSIMapStrongKeyAndVal;
#endif
t = (GSIMapTable)NSAllocateCollectable(sizeof(GSIMapTable_t),
NSScannedOption);
#else
t = (GSIMapTable)NSZoneMalloc(zone, sizeof(GSIMapTable_t));
#endif
GSIMapInitWithZoneAndCapacity(t, zone, ((GSIMapTable)table)->nodeCount);
t->extra.k = ((GSIMapTable)table)->extra.k;
t->extra.v = ((GSIMapTable)table)->extra.v;
@ -275,8 +278,11 @@ NSCreateMapTableWithZone(
#if GS_WITH_GC
zone = GSIMapStrongKeyAndVal;
#endif
table = (GSIMapTable)NSAllocateCollectable(sizeof(GSIMapTable_t),
NSScannedOption);
#else
table = (GSIMapTable)NSZoneMalloc(zone, sizeof(GSIMapTable_t));
#endif
GSIMapInitWithZoneAndCapacity(table, zone, capacity);
table->extra.k = keyCallBacks;
table->extra.v = valueCallBacks;

View file

@ -281,9 +281,16 @@ static Observation *obsNew(NCTable* t)
unsigned size;
t->numChunks++;
size = t->numChunks * sizeof(Observation*);
#if GS_WITH_GC
t->chunks = (Observation**)NSReallocateCollectable(
t->chunks, size, NSScannedOption);
#else
t->chunks = (Observation**)NSZoneRealloc(NSDefaultMallocZone(),
t->chunks, size);
#endif
size = CHUNKSIZE * sizeof(Observation);
#if GS_WITH_GC
t->chunks[t->numChunks - 1]
@ -327,7 +334,9 @@ static GSIMapTable mapNew(NCTable *t)
static void mapFree(NCTable *t, GSIMapTable m)
{
if (t->cacheIndex < CACHESIZE)
t->cache[t->cacheIndex++] = m;
{
t->cache[t->cacheIndex++] = m;
}
else
{
GSIMapEmptyMap(m);