aboutsummaryrefslogtreecommitdiff
path: root/gcc/objc
diff options
context:
space:
mode:
authorDennis Glatting <dennisg@gnu.org>1991-11-23 22:18:29 +0000
committerDennis Glatting <dennisg@gnu.org>1991-11-23 22:18:29 +0000
commitb6793c3947f3c2fc625306616cb846ca54546ee6 (patch)
tree48f247ddc3dde5ed958e69fae8bd757c75250d55 /gcc/objc
parent7e8ead54c20a5d007f2f4169acd9353403a3fc38 (diff)
downloadgcc-b6793c3947f3c2fc625306616cb846ca54546ee6.zip
gcc-b6793c3947f3c2fc625306616cb846ca54546ee6.tar.gz
gcc-b6793c3947f3c2fc625306616cb846ca54546ee6.tar.bz2
deleted hashIndex() and moved it to hash-inline.h converted...
deleted hashIndex() and moved it to hash-inline.h converted hash_value_for_key() to a inline and moved it to hash-inline.h. From-SVN: r67
Diffstat (limited to 'gcc/objc')
-rw-r--r--gcc/objc/hash.c47
1 files changed, 12 insertions, 35 deletions
diff --git a/gcc/objc/hash.c b/gcc/objc/hash.c
index 620ff79..3bef4f8 100644
--- a/gcc/objc/hash.c
+++ b/gcc/objc/hash.c
@@ -16,10 +16,17 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- $Header: /usr/user/dennis_glatting/ObjC/c-runtime/lib/RCS/hash.c,v 0.5 1991/11/20 23:29:20 dennisg Exp dennisg $
+ $Header: /usr/user/dennis_glatting/ObjC/c-runtime/lib/RCS/hash.c,v 0.6 1991/11/21 22:27:06 dennisg Exp dennisg $
$Author: dennisg $
- $Date: 1991/11/20 23:29:20 $
+ $Date: 1991/11/21 22:27:06 $
$Log: hash.c,v $
+ * Revision 0.6 1991/11/21 22:27:06 dennisg
+ * changed hash value calculation.
+ * func name changed from hashValue() to hashIndex(). the
+ * func really calculated a index anyway.
+ * changed hash func impl. essentially it was calculating a hash value
+ * from a hash value. this is a implementation thing.
+ *
* Revision 0.5 1991/11/20 23:29:20 dennisg
* converted hashIndex() to a inline.
*
@@ -43,6 +50,7 @@
#include <hash.h>
+#include <hash-inline.h>
#include <ObjC.h>
#include <ObjC-private.h>
@@ -63,15 +71,6 @@
(((cache)->sizeOfHash * 175 ) / 100 )
-static inline u_int hashIndex( Cache_t theCache, void* aKey ) {
-
-
- assert (sizeof (u_int) == sizeof (void*));
-
- return ((u_int)aKey) % theCache->sizeOfHash ;
-}
-
-
Cache_t hash_new( u_int sizeOfHash ) {
Cache_t retCache;
@@ -118,7 +117,7 @@ void hash_delete( Cache_t theCache ) {
void hash_add( Cache_t* theCache, void* aKey, void* aValue ) {
- u_int indx = hashIndex( *theCache, aKey );
+ u_short indx = hashIndex( *theCache, aKey );
CacheNode_t aCacheNode = calloc( 1, sizeof( CacheNode ));
@@ -190,7 +189,7 @@ void hash_add( Cache_t* theCache, void* aKey, void* aValue ) {
void hash_remove( Cache_t theCache, void* aKey ) {
- u_int indx = hashIndex( theCache, aKey );
+ u_short indx = hashIndex( theCache, aKey );
CacheNode_t aCacheNode = ( *theCache->theNodeTable )[ indx ];
@@ -228,28 +227,6 @@ void hash_remove( Cache_t theCache, void* aKey ) {
}
-void* hash_value_for_key( Cache_t theCache, void* aKey ) {
-
- u_int indx = hashIndex( theCache, aKey );
- CacheNode_t aCacheNode = ( *theCache->theNodeTable )[ indx ];
- void* retVal = NULL;
-
-
- if( aCacheNode ) {
- BOOL found = NO;
-
- do {
- if( aCacheNode->theKey == aKey )
- retVal = aCacheNode->theValue, found = YES;
- else
- aCacheNode = aCacheNode->nextNode;
- } while( !found && aCacheNode );
- }
-
- return retVal;
-}
-
-
CacheNode_t hash_next( Cache_t theCache, CacheNode_t aCacheNode ) {
CacheNode_t theCacheNode = aCacheNode;