Tidied retain mechanism

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@3644 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 1999-02-03 13:49:44 +00:00
parent 4b2e7d0859
commit c2c4c8dd43
3 changed files with 10 additions and 6 deletions

View file

@ -102,7 +102,8 @@ FastArrayAddItem(FastArray array, FastArrayItem item)
array->old = array->cap;
array->cap = next;
}
array->ptr[array->count++] = FAST_ARRAY_RETAIN(item);
FAST_ARRAY_RETAIN(item);
array->ptr[array->count++] = item;
}
static INLINE void
@ -122,7 +123,8 @@ FastArraySetItemAtIndex(FastArray array, FastArrayItem item, unsigned index)
if (array->ptr[index].o != item.o)
{
FAST_ARRAY_RELEASE(array->ptr[index]);
array->ptr[index] = FAST_ARRAY_RETAIN(item);
FAST_ARRAY_RETAIN(item);
array->ptr[index] = item;
}
}

View file

@ -93,6 +93,7 @@
typedef union {
id o;
NSObject *O;
Class c;
SEL C;
int i;
@ -529,8 +530,8 @@ FastMapAddPair(FastMapTable map, FastMapItem key, FastMapItem value)
{
FastMapNode node;
key = FAST_MAP_RETAIN_KEY(key);
value = FAST_MAP_RETAIN_VAL(value);
FAST_MAP_RETAIN_KEY(key);
FAST_MAP_RETAIN_VAL(value);
node = FastMapNewNode(map, key, value);
if (node != 0)
@ -561,7 +562,7 @@ FastMapAddKey(FastMapTable map, FastMapItem key)
{
FastMapNode node;
key = FAST_MAP_RETAIN_KEY(key);
FAST_MAP_RETAIN_KEY(key);
node = FastMapNewNode(map, key);
if (node != 0)

View file

@ -102,7 +102,8 @@ myEqual(id self, id other)
*/
#define FAST_MAP_HASH(X) myHash(X.o)
#define FAST_MAP_EQUAL(X,Y) myEqual(X.o,Y.o)
#define FAST_MAP_RETAIN_KEY(X) [((id)(X).o) copyWithZone: map->zone]
#define FAST_MAP_RETAIN_KEY(X) ((id)(X).o) = \
[((id)(X).o) copyWithZone: map->zone]
#include "FastMap.x"