index d9ec82fa663804210e8ef200f2f300e914662f22..1cd4c9d5c0945994b84bb25edd6e4685cf76b5c5 100644 (file)
--- a/hash.c
+++ b/hash.c
* the existing entry, or the empty slot if none existed. The caller
* can then look at the (*ptr) to see whether it existed or not.
*/
* the existing entry, or the empty slot if none existed. The caller
* can then look at the (*ptr) to see whether it existed or not.
*/
-static struct hash_table_entry *lookup_hash_entry(unsigned int hash, struct hash_table *table)
+static struct hash_table_entry *lookup_hash_entry(unsigned int hash, const struct hash_table *table)
{
unsigned int size = table->size, nr = hash % size;
struct hash_table_entry *array = table->array;
{
unsigned int size = table->size, nr = hash % size;
struct hash_table_entry *array = table->array;
free(old_array);
}
free(old_array);
}
-void *lookup_hash(unsigned int hash, struct hash_table *table)
+void *lookup_hash(unsigned int hash, const struct hash_table *table)
{
if (!table->array)
return NULL;
{
if (!table->array)
return NULL;
return insert_hash_entry(hash, ptr, table);
}
return insert_hash_entry(hash, ptr, table);
}
-int for_each_hash(struct hash_table *table, int (*fn)(void *))
+int for_each_hash(const struct hash_table *table, int (*fn)(void *))
{
int sum = 0;
unsigned int i;
{
int sum = 0;
unsigned int i;