Fixed copy

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@4064 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
richard 1999-04-12 12:54:14 +00:00
parent eb098ecf55
commit 8607046df3

View file

@ -1,7 +1,7 @@
/* Concrete implementation of NSSet based on GNU Set class /* Concrete implementation of NSSet based on GNU Set class
Copyright (C) 1998 Free Software Foundation, Inc. Copyright (C) 1998 Free Software Foundation, Inc.
Written by: Richard frith-Macdonald <richard@brainstorm.co.Ik> Written by: Richard frith-Macdonald <richard@brainstorm.co.uk>
Created: October 1998 Created: October 1998
This file is part of the GNUstep Base Library. This file is part of the GNUstep Base Library.
@ -33,8 +33,10 @@
#define FAST_MAP_RETAIN_VAL(X) X #define FAST_MAP_RETAIN_VAL(X) X
#define FAST_MAP_RELEASE_VAL(X) #define FAST_MAP_RELEASE_VAL(X)
#define FAST_MAP_KTYPES GSUNION_OBJ
#define FAST_MAP_VTYPES GSUNION_INT
#include "FastMap.x" #include <base/FastMap.x>
@class NSSetNonCore; @class NSSetNonCore;
@class NSMutableSetNonCore; @class NSMutableSetNonCore;
@ -75,7 +77,7 @@
return nil; return nil;
} }
node = node->nextInMap; node = node->nextInMap;
return old->key.o; return old->key.obj;
} }
- (void) dealloc - (void) dealloc
@ -118,8 +120,8 @@
while (node != 0) while (node != 0)
{ {
(*imp1)(aCoder, sel1, node->key.o); (*imp1)(aCoder, sel1, node->key.obj);
(*imp2)(aCoder, sel2, type, &node->value.I); (*imp2)(aCoder, sel2, type, &node->value.uint);
node = node->nextInMap; node = node->nextInMap;
} }
} }
@ -141,7 +143,7 @@
{ {
(*imp)(aCoder, sel, otype, &value); (*imp)(aCoder, sel, otype, &value);
(*imp)(aCoder, sel, utype, &valcnt); (*imp)(aCoder, sel, utype, &valcnt);
FastMapAddPairNoRetain(&map, (FastMapItem)value, (FastMapItem)valcnt); FastMapAddPairNoRetain(&map, (FastMapKey)value, (FastMapVal)valcnt);
} }
return self; return self;
@ -172,14 +174,14 @@
[NSException raise: NSInvalidArgumentException [NSException raise: NSInvalidArgumentException
format: @"Tried to init counted set with nil value"]; format: @"Tried to init counted set with nil value"];
} }
node = FastMapNodeForKey(&map, (FastMapItem)objs[i]); node = FastMapNodeForKey(&map, (FastMapKey)objs[i]);
if (node == 0) if (node == 0)
{ {
FastMapAddPair(&map,(FastMapItem)objs[i],(FastMapItem)(unsigned)1); FastMapAddPair(&map,(FastMapKey)objs[i],(FastMapVal)(unsigned)1);
} }
else else
{ {
node->value.I++; node->value.uint++;
} }
} }
return self; return self;
@ -195,14 +197,14 @@
format: @"Tried to nil value to counted set"]; format: @"Tried to nil value to counted set"];
} }
node = FastMapNodeForKey(&map, (FastMapItem)anObject); node = FastMapNodeForKey(&map, (FastMapKey)anObject);
if (node == 0) if (node == 0)
{ {
FastMapAddPair(&map,(FastMapItem)anObject,(FastMapItem)(unsigned)1); FastMapAddPair(&map,(FastMapKey)anObject,(FastMapVal)(unsigned)1);
} }
else else
{ {
node->value.I++; node->value.uint++;
} }
} }
@ -215,11 +217,11 @@
{ {
if (anObject) if (anObject)
{ {
FastMapNode node = FastMapNodeForKey(&map, (FastMapItem)anObject); FastMapNode node = FastMapNodeForKey(&map, (FastMapKey)anObject);
if (node) if (node)
{ {
return node->value.I; return node->value.uint;
} }
} }
return 0; return 0;
@ -234,11 +236,11 @@
{ {
if (anObject) if (anObject)
{ {
FastMapNode node = FastMapNodeForKey(&map, (FastMapItem)anObject); FastMapNode node = FastMapNodeForKey(&map, (FastMapKey)anObject);
if (node) if (node)
{ {
return node->key.o; return node->key.obj;
} }
} }
return nil; return nil;
@ -255,15 +257,15 @@
{ {
FastMapBucket bucket; FastMapBucket bucket;
bucket = FastMapBucketForKey(&map, (FastMapItem)anObject); bucket = FastMapBucketForKey(&map, (FastMapKey)anObject);
if (bucket) if (bucket)
{ {
FastMapNode node; FastMapNode node;
node = FastMapNodeForKeyInBucket(bucket, (FastMapItem)anObject); node = FastMapNodeForKeyInBucket(bucket, (FastMapKey)anObject);
if (node) if (node)
{ {
if (--node->value.I == 0) if (--node->value.uint == 0)
{ {
FastMapRemoveNodeFromMap(&map, bucket, node); FastMapRemoveNodeFromMap(&map, bucket, node);
FastMapFreeNode(&map, node); FastMapFreeNode(&map, node);