Commit 334fe450 authored by Ben Gamari's avatar Ben Gamari Committed by Austin Seipp

rts/Hash: Constify HashTable* in lookupHashTable

This seems like an obvious place to apply `const`

Reviewed By: simonmar, austin

Differential Revision: https://phabricator.haskell.org/D1416
parent b62605e5
......@@ -41,7 +41,7 @@ static int cmpLocks(StgWord w1, StgWord w2)
return (l1->device == l2->device && l1->inode == l2->inode);
}
static int hashLock(HashTable *table, StgWord w)
static int hashLock(const HashTable *table, StgWord w)
{
Lock *l = (Lock *)w;
StgWord key = l->inode ^ (l->inode >> 32) ^ l->device ^ (l->device >> 32);
......
......@@ -58,7 +58,7 @@ struct hashtable {
* -------------------------------------------------------------------------- */
int
hashWord(HashTable *table, StgWord key)
hashWord(const HashTable *table, StgWord key)
{
int bucket;
......@@ -76,7 +76,7 @@ hashWord(HashTable *table, StgWord key)
}
int
hashStr(HashTable *table, char *key)
hashStr(const HashTable *table, char *key)
{
int h, bucket;
char *s;
......@@ -187,7 +187,7 @@ expand(HashTable *table)
}
void *
lookupHashTable(HashTable *table, StgWord key)
lookupHashTable(const HashTable *table, StgWord key)
{
int bucket;
int segment;
......
......@@ -15,7 +15,7 @@ typedef struct hashtable HashTable; /* abstract */
/* Hash table access where the keys are StgWords */
HashTable * allocHashTable ( void );
void * lookupHashTable ( HashTable *table, StgWord key );
void * lookupHashTable ( const HashTable *table, StgWord key );
void insertHashTable ( HashTable *table, StgWord key, void *data );
void * removeHashTable ( HashTable *table, StgWord key, void *data );
......@@ -44,11 +44,11 @@ HashTable * allocStrHashTable ( void );
(removeHashTable(table, (StgWord)key, data))
/* Hash tables for arbitrary keys */
typedef int HashFunction(HashTable *table, StgWord key);
typedef int HashFunction(const HashTable *table, StgWord key);
typedef int CompareFunction(StgWord key1, StgWord key2);
HashTable * allocHashTable_(HashFunction *hash, CompareFunction *compare);
int hashWord(HashTable *table, StgWord key);
int hashStr(HashTable *table, char *key);
int hashWord(const HashTable *table, StgWord key);
int hashStr(const HashTable *table, char *key);
/* Freeing hash tables
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment