mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 08:21:25 +00:00
more gc fixups
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@28228 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
a4baaba7c5
commit
7e2dfe453b
7 changed files with 191 additions and 139 deletions
|
@ -173,16 +173,16 @@ NSCompareHashTables(NSHashTable *table1, NSHashTable *table2)
|
|||
{
|
||||
BOOL result = YES;
|
||||
NSHashEnumerator enumerator;
|
||||
GSIMapNode n;
|
||||
GSIMapNode n1;
|
||||
|
||||
enumerator = NSEnumerateHashTable(table1);
|
||||
if (GSObjCClass(table2) == concreteClass)
|
||||
{
|
||||
GSIMapTable t2 = (GSIMapTable)table2;
|
||||
|
||||
while ((n = GSIMapEnumeratorNextNode(&enumerator)) != 0)
|
||||
while ((n1 = GSIMapEnumeratorNextNode(&enumerator)) != 0)
|
||||
{
|
||||
if (GSIMapNodeForKey(t2, n->key) == 0)
|
||||
if (GSIMapNodeForKey(t2, n1->key) == 0)
|
||||
{
|
||||
result = NO;
|
||||
break;
|
||||
|
@ -191,12 +191,13 @@ NSCompareHashTables(NSHashTable *table1, NSHashTable *table2)
|
|||
}
|
||||
else
|
||||
{
|
||||
while ((n = GSIMapEnumeratorNextNode(&enumerator)) != 0)
|
||||
while ((n1 = GSIMapEnumeratorNextNode(&enumerator)) != 0)
|
||||
{
|
||||
void *v1 = n1->key.ptr;
|
||||
void *v2;
|
||||
|
||||
v2 = NSHashGet(table2, n->key.ptr);
|
||||
if (v2 == 0 && v2 != n->key.ptr)
|
||||
v2 = NSHashGet(table2, v1);
|
||||
if (v2 == 0 && v2 != v1)
|
||||
{
|
||||
result = NO;
|
||||
break;
|
||||
|
@ -215,9 +216,10 @@ NSCompareHashTables(NSHashTable *table1, NSHashTable *table2)
|
|||
enumerator = NSEnumerateHashTable(table1);
|
||||
while ((v1 = NSNextHashEnumeratorItem(&enumerator)) != 0)
|
||||
{
|
||||
void *v2 = NSHashGet(table2, v1);
|
||||
void *v2;
|
||||
|
||||
if ((v2 = NSHashGet(table2, v1)) == 0)
|
||||
v2 = NSHashGet(table2, v1);
|
||||
if (v2 == 0 && v2 != v1)
|
||||
{
|
||||
result = NO;
|
||||
break;
|
||||
|
@ -793,29 +795,20 @@ const NSHashTableCallBacks NSPointerToStructHashCallBacks =
|
|||
- (id) initWithPointerFunctions: (NSPointerFunctions*)functions
|
||||
capacity: (NSUInteger)initialCapacity
|
||||
{
|
||||
if (functions == nil)
|
||||
{
|
||||
functions = [NSPointerFunctions pointerFunctionsWithOptions: 0];
|
||||
}
|
||||
legacy = NO;
|
||||
if ([functions class] == [NSConcretePointerFunctions class])
|
||||
if (![functions isKindOfClass: [NSConcretePointerFunctions class]])
|
||||
{
|
||||
memcpy(&self->cb.pf, &((NSConcretePointerFunctions*)functions)->_x,
|
||||
sizeof(self->cb.pf));
|
||||
}
|
||||
else
|
||||
{
|
||||
self->cb.pf.acquireFunction = [functions acquireFunction];
|
||||
self->cb.pf.descriptionFunction = [functions descriptionFunction];
|
||||
self->cb.pf.hashFunction = [functions hashFunction];
|
||||
self->cb.pf.isEqualFunction = [functions isEqualFunction];
|
||||
self->cb.pf.relinquishFunction = [functions relinquishFunction];
|
||||
self->cb.pf.sizeFunction = [functions sizeFunction];
|
||||
self->cb.pf.usesStrongWriteBarrier
|
||||
= [functions usesStrongWriteBarrier];
|
||||
self->cb.pf.usesWeakReadAndWriteBarriers
|
||||
= [functions usesWeakReadAndWriteBarriers];
|
||||
static NSConcretePointerFunctions *defaultFunctions = nil;
|
||||
|
||||
if (defaultFunctions == nil)
|
||||
{
|
||||
defaultFunctions
|
||||
= [[NSConcretePointerFunctions alloc] initWithOptions: 0];
|
||||
}
|
||||
functions = defaultFunctions;
|
||||
}
|
||||
memcpy(&self->cb.pf, &((NSConcretePointerFunctions*)functions)->_x,
|
||||
sizeof(self->cb.pf));
|
||||
|
||||
#if GC_WITH_GC
|
||||
if (self->cb.pf.usesWeakReadAndWriteBarriers)
|
||||
|
@ -831,11 +824,6 @@ const NSHashTableCallBacks NSPointerToStructHashCallBacks =
|
|||
return self;
|
||||
}
|
||||
|
||||
- (BOOL) isEqualToHashTable: (NSHashTable*)other
|
||||
{
|
||||
return NSCompareHashTables(self, other);
|
||||
}
|
||||
|
||||
- (NSEnumerator*) objectEnumerator
|
||||
{
|
||||
return [self subclassResponsibility: _cmd];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue