summaryrefslogtreecommitdiff
path: root/rts
diff options
context:
space:
mode:
authorBen Gamari <bgamari.foss@gmail.com>2015-11-03 16:16:27 -0600
committerAustin Seipp <austin@well-typed.com>2015-11-03 16:16:30 -0600
commit334fe4500c234e83f250f74679f7bbe20208abba (patch)
tree2fad3f32a81b9fe2a4b0eaa3dd4026728851ab1d /rts
parentb62605e53c167719b3bf8842eba628061cf22dd1 (diff)
downloadhaskell-334fe4500c234e83f250f74679f7bbe20208abba.tar.gz
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
Diffstat (limited to 'rts')
-rw-r--r--rts/FileLock.c2
-rw-r--r--rts/Hash.c6
-rw-r--r--rts/Hash.h8
3 files changed, 8 insertions, 8 deletions
diff --git a/rts/FileLock.c b/rts/FileLock.c
index cd2dc1d1dc..f8e11ee1bf 100644
--- a/rts/FileLock.c
+++ b/rts/FileLock.c
@@ -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);
diff --git a/rts/Hash.c b/rts/Hash.c
index aab3b2361b..b0939c49bc 100644
--- a/rts/Hash.c
+++ b/rts/Hash.c
@@ -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;
diff --git a/rts/Hash.h b/rts/Hash.h
index 136f94a18c..c2dfc26d6d 100644
--- a/rts/Hash.h
+++ b/rts/Hash.h
@@ -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
*/