mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-20 12:16:40 +00:00
More moves towards OSX 10.5 GC compatibility.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@28054 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
00e2bbb843
commit
bc9468c45f
25 changed files with 553 additions and 282 deletions
|
@ -37,6 +37,13 @@
|
|||
#define GSI_MAP_KTYPES GSUNION_OBJ
|
||||
#define GSI_MAP_VTYPES GSUNION_INT
|
||||
|
||||
#if GS_WITH_GC
|
||||
#include <gc_typed.h>
|
||||
static GC_descr nodeDesc; // Type descriptor for map node.
|
||||
#define GSI_MAP_NODES(M, X) \
|
||||
(GSIMapNode)GC_calloc_explicitly_typed(X, sizeof(GSIMapNode_t), nodeDesc)
|
||||
#endif
|
||||
|
||||
#include "GNUstepBase/GSIMap.h"
|
||||
|
||||
@interface GSCountedSet : NSCountedSet
|
||||
|
@ -93,6 +100,14 @@
|
|||
{
|
||||
if (self == [GSCountedSet class])
|
||||
{
|
||||
#if GS_WITH_GC
|
||||
/* We create a typed memory descriptor for map nodes.
|
||||
* Only the pointer to the key needs to be scanned.
|
||||
*/
|
||||
GC_word w[GC_BITMAP_SIZE(GSIMapNode_t)] = {0};
|
||||
GC_set_bit(w, GC_WORD_OFFSET(GSIMapNode_t, key));
|
||||
nodeDesc = GC_make_descriptor(w, GC_WORD_LEN(GSIMapNode_t));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -183,11 +198,7 @@
|
|||
/* Designated initialiser */
|
||||
- (id) initWithCapacity: (unsigned)cap
|
||||
{
|
||||
#if GS_WITH_GC
|
||||
GSIMapInitWithZoneAndCapacity(&map, GSIMapStrongKeyAndVal, cap);
|
||||
#else
|
||||
GSIMapInitWithZoneAndCapacity(&map, [self zone], cap);
|
||||
#endif
|
||||
return self;
|
||||
}
|
||||
|
||||
|
@ -203,11 +214,7 @@
|
|||
|
||||
(*imp)(aCoder, sel, utype, &count);
|
||||
|
||||
#if GS_WITH_GC
|
||||
GSIMapInitWithZoneAndCapacity(&map, GSIMapStrongKeyAndVal, count);
|
||||
#else
|
||||
GSIMapInitWithZoneAndCapacity(&map, [self zone], count);
|
||||
#endif
|
||||
while (count-- > 0)
|
||||
{
|
||||
(*imp)(aCoder, sel, otype, &value);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue