Remove old gsi api

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@12368 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
CaS 2002-02-01 15:22:41 +00:00
parent 1585a094a9
commit 74b12aa623
3 changed files with 1 additions and 161 deletions

View file

@ -66,14 +66,6 @@
*/
/*
* If GSI_NEW is defined we expect to pass a pointer to the maptable as
* the first argument to each macro so we can have the macros behave
* differently for different maptables.
* The old version will become obsolete and be removed at some point.
*/
#ifdef GSI_NEW
#ifdef GSI_ARRAY_NO_RETAIN
#ifdef GSI_ARRAY_RETAIN
#undef GSI_ARRAY_RETAIN
@ -96,32 +88,6 @@
#endif
#endif
#else
#ifdef GSI_ARRAY_NO_RETAIN
#ifdef GSI_ARRAY_RETAIN
#undef GSI_ARRAY_RETAIN
#endif
#define GSI_ARRAY_RETAIN(X)
#else
#ifndef GSI_ARRAY_RETAIN
#define GSI_ARRAY_RETAIN(X) [(X).obj retain]
#endif
#endif
#ifdef GSI_ARRAY_NO_RELEASE
#ifdef GSI_ARRAY_RELEASE
#undef GSI_ARRAY_RELEASE
#endif
#define GSI_ARRAY_RELEASE(X)
#else
#ifndef GSI_ARRAY_RELEASE
#define GSI_ARRAY_RELEASE(X) [(X).obj release]
#endif
#endif
#endif
/*
* If there is no bitmask defined to supply the types that
* may be stored in the array, default to permitting all types.
@ -153,19 +119,10 @@
/*
* Override extra type used in array value
*/
#ifdef GSI_NEW
#ifdef GSI_ARRAY_TYPE
#define GSUNION_EXTRA GSI_ARRAY_TYPE
#endif
#else
#ifdef GSI_ARRAY_EXTRA
#define GSUNION_EXTRA GSI_ARRAY_EXTRA
#endif
#endif
/*
* Generate the union typedef
*/
@ -177,11 +134,9 @@ struct _GSIArray {
unsigned cap;
unsigned old;
NSZone *zone;
#ifdef GSI_NEW
#ifdef GSI_ARRAY_EXTRA
GSI_ARRAY_EXTRA extra;
#endif
#endif
};
typedef struct _GSIArray GSIArray_t;
typedef struct _GSIArray *GSIArray;
@ -248,11 +203,7 @@ GSIArrayInsertItem(GSIArray array, GSIArrayItem item, unsigned index)
{
unsigned i;
#ifdef GSI_NEW
GSI_ARRAY_RETAIN(array, item);
#else
GSI_ARRAY_RETAIN(item);
#endif
GSI_ARRAY_CHECK;
if (array->count == array->cap)
{
@ -287,11 +238,7 @@ GSIArrayInsertItemNoRetain(GSIArray array, GSIArrayItem item, unsigned index)
static INLINE void
GSIArrayAddItem(GSIArray array, GSIArrayItem item)
{
#ifdef GSI_NEW
GSI_ARRAY_RETAIN(array, item);
#else
GSI_ARRAY_RETAIN(item);
#endif
GSI_ARRAY_CHECK;
if (array->count == array->cap)
{
@ -418,11 +365,7 @@ GSIArrayRemoveItemAtIndex(GSIArray array, unsigned index)
while (++index < array->count)
array->ptr[index-1] = array->ptr[index];
array->count--;
#ifdef GSI_NEW
GSI_ARRAY_RELEASE(array, tmp);
#else
GSI_ARRAY_RELEASE(tmp);
#endif
}
static INLINE void
@ -431,11 +374,7 @@ GSIArrayRemoveLastItem(GSIArray array)
#ifdef GSI_ARRAY_CHECKS
NSCAssert(array->count, NSInvalidArgumentException);
#endif
#ifdef GSI_NEW
GSI_ARRAY_RELEASE(array, array->ptr[array->count-1]);
#else
GSI_ARRAY_RELEASE(array->ptr[array->count-1]);
#endif
array->count--;
}
@ -460,17 +399,9 @@ GSIArraySetItemAtIndex(GSIArray array, GSIArrayItem item, unsigned index)
NSCAssert(index < array->count, NSInvalidArgumentException);
#endif
tmp = array->ptr[index];
#ifdef GSI_NEW
GSI_ARRAY_RETAIN(array, item);
#else
GSI_ARRAY_RETAIN(item);
#endif
array->ptr[index] = item;
#ifdef GSI_NEW
GSI_ARRAY_RELEASE(array, tmp);
#else
GSI_ARRAY_RELEASE(tmp);
#endif
}
static INLINE GSIArrayItem
@ -510,11 +441,7 @@ GSIArrayRemoveItemsFromIndex(GSIArray array, unsigned index)
#ifndef GSI_ARRAY_NO_RELEASE
while (array->count-- > index)
{
#ifdef GSI_NEW
GSI_ARRAY_RELEASE(array, array->ptr[array->count]);
#else
GSI_ARRAY_RELEASE(array->ptr[array->count]);
#endif
}
#endif
array->count = index;
@ -527,11 +454,7 @@ GSIArrayRemoveAllItems(GSIArray array)
#ifndef GSI_ARRAY_NO_RELEASE
while (array->count--)
{
#ifdef GSI_NEW
GSI_ARRAY_RELEASE(array, array->ptr[array->count]);
#else
GSI_ARRAY_RELEASE(array->ptr[array->count]);
#endif
}
#endif
array->count = 0;
@ -570,11 +493,7 @@ GSIArrayCopyWithZone(GSIArray array, NSZone *zone)
for (i = 0; i < array->count; i++)
{
#ifdef GSI_NEW
GSI_ARRAY_RETAIN(array, array->ptr[i]);
#else
GSI_ARRAY_RETAIN(array->ptr[i]);
#endif
new->ptr[new->count++] = array->ptr[i];
}
return new;

View file

@ -72,14 +72,6 @@
#define GSI_MAP_HAS_VALUE 1
#endif
/*
* If GSI_NEW is defined we expect to pass a pointer to the maptable as
* the first argument to each macro so we can have the macros behave
* differently for different maptables.
* The old version will become obsolete and be removed at some point.
*/
#ifdef GSI_NEW
#ifndef GSI_MAP_RETAIN_KEY
#define GSI_MAP_RETAIN_KEY(M, X) [(X).obj retain]
#endif
@ -99,29 +91,6 @@
#define GSI_MAP_EQUAL(M, X, Y) [(X).obj isEqual: (Y).obj]
#endif
#else
#ifndef GSI_MAP_RETAIN_KEY
#define GSI_MAP_RETAIN_KEY(X) [(X).obj retain]
#endif
#ifndef GSI_MAP_RELEASE_KEY
#define GSI_MAP_RELEASE_KEY(X) [(X).obj release]
#endif
#ifndef GSI_MAP_RETAIN_VAL
#define GSI_MAP_RETAIN_VAL(X) [(X).obj retain]
#endif
#ifndef GSI_MAP_RELEASE_VAL
#define GSI_MAP_RELEASE_VAL(X) [(X).obj release]
#endif
#ifndef GSI_MAP_HASH
#define GSI_MAP_HASH(X) [(X).obj hash]
#endif
#ifndef GSI_MAP_EQUAL
#define GSI_MAP_EQUAL(X, Y) [(X).obj isEqual: (Y).obj]
#endif
#endif
/*
* If there is no bitmask defined to supply the types that
* may be used as keys in the map, default to permitting all types.
@ -251,13 +220,8 @@ GSIMapPickBucket(unsigned hash, GSIMapBucket buckets, size_t bucketCount)
static INLINE GSIMapBucket
GSIMapBucketForKey(GSIMapTable map, GSIMapKey key)
{
#ifdef GSI_NEW
return GSIMapPickBucket(GSI_MAP_HASH(map, key),
map->buckets, map->bucketCount);
#else
return GSIMapPickBucket(GSI_MAP_HASH(key),
map->buckets, map->bucketCount);
#endif
}
static INLINE void
@ -363,13 +327,8 @@ GSIMapRemangleBuckets(GSIMapTable map,
GSIMapBucket bkt;
GSIMapRemoveNodeFromBucket(old_buckets, node);
#ifdef GSI_NEW
bkt = GSIMapPickBucket(GSI_MAP_HASH(map, node->key),
new_buckets, new_bucketCount);
#else
bkt = GSIMapPickBucket(GSI_MAP_HASH(node->key),
new_buckets, new_bucketCount);
#endif
GSIMapAddNodeToBucket(bkt, node);
}
old_buckets++;
@ -487,22 +446,14 @@ GSIMapNewNode(GSIMapTable map, GSIMapKey key)
static INLINE void
GSIMapFreeNode(GSIMapTable map, GSIMapNode node)
{
#ifdef GSI_NEW
GSI_MAP_RELEASE_KEY(map, node->key);
#if GSI_MAP_HAS_VALUE
GSI_MAP_RELEASE_VAL(map, node->value);
#endif
#else
GSI_MAP_RELEASE_KEY(node->key);
#if GSI_MAP_HAS_VALUE
GSI_MAP_RELEASE_VAL(node->value);
#endif
#endif
node->nextInMap = map->freeNodes;
map->freeNodes = node;
}
#ifdef GSI_NEW
static INLINE GSIMapNode
GSIMapNodeForKeyInBucket(GSIMapTable map, GSIMapBucket bucket, GSIMapKey key)
{
@ -514,19 +465,6 @@ GSIMapNodeForKeyInBucket(GSIMapTable map, GSIMapBucket bucket, GSIMapKey key)
}
return node;
}
#else
static INLINE GSIMapNode
GSIMapNodeForKeyInBucket(GSIMapBucket bucket, GSIMapKey key)
{
GSIMapNode node = bucket->firstNode;
while ((node != 0) && GSI_MAP_EQUAL(node->key, key) == NO)
{
node = node->nextInBucket;
}
return node;
}
#endif
static INLINE GSIMapNode
GSIMapNodeForKey(GSIMapTable map, GSIMapKey key)
@ -537,11 +475,7 @@ GSIMapNodeForKey(GSIMapTable map, GSIMapKey key)
if (map->nodeCount == 0)
return 0;
bucket = GSIMapBucketForKey(map, key);
#ifdef GSI_NEW
node = GSIMapNodeForKeyInBucket(map, bucket, key);
#else
node = GSIMapNodeForKeyInBucket(bucket, key);
#endif
return node;
}
@ -689,13 +623,8 @@ GSIMapAddPair(GSIMapTable map, GSIMapKey key, GSIMapVal value)
{
GSIMapNode node;
#ifdef GSI_NEW
GSI_MAP_RETAIN_KEY(map, key);
GSI_MAP_RETAIN_VAL(map, value);
#else
GSI_MAP_RETAIN_KEY(key);
GSI_MAP_RETAIN_VAL(value);
#endif
node = GSIMapNewNode(map, key, value);
if (node != 0)
@ -726,11 +655,7 @@ GSIMapAddKey(GSIMapTable map, GSIMapKey key)
{
GSIMapNode node;
#ifdef GSI_NEW
GSI_MAP_RETAIN_KEY(map, key);
#else
GSI_MAP_RETAIN_KEY(key);
#endif
node = GSIMapNewNode(map, key);
if (node != 0)
@ -751,11 +676,7 @@ GSIMapRemoveKey(GSIMapTable map, GSIMapKey key)
{
GSIMapNode node;
#ifdef GSI_NEW
node = GSIMapNodeForKeyInBucket(map, bucket, key);
#else
node = GSIMapNodeForKeyInBucket(bucket, key);
#endif
if (node != 0)
{
GSIMapRemoveNodeFromMap(map, bucket, node);

View file

@ -39,7 +39,7 @@
#
# Additional flags to pass to the preprocessor
ADDITIONAL_CPPFLAGS = -DGSI_NEW=1 $(DEFS) $(CONFIG_SYSTEM_DEFS) -Wall
ADDITIONAL_CPPFLAGS = $(DEFS) $(CONFIG_SYSTEM_DEFS) -Wall
# Additional flags to pass to the Objective-C compiler
ADDITIONAL_OBJCFLAGS = $(SSLFLAGS)