Xext: Clean up warnings in hashtable code

Make keys const void *

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
This commit is contained in:
Keith Packard 2013-11-15 05:55:38 -08:00
parent 00438c9f94
commit af04cf6968
2 changed files with 6 additions and 6 deletions

View File

@ -118,7 +118,7 @@ double_size(HashTable ht)
} }
pointer pointer
ht_add(HashTable ht, pointer key) ht_add(HashTable ht, const void *key)
{ {
unsigned index = ht->hash(ht->cdata, key, ht->bucketBits); unsigned index = ht->hash(ht->cdata, key, ht->bucketBits);
struct xorg_list *bucket = &ht->buckets[index]; struct xorg_list *bucket = &ht->buckets[index];
@ -164,7 +164,7 @@ ht_add(HashTable ht, pointer key)
} }
void void
ht_remove(HashTable ht, pointer key) ht_remove(HashTable ht, const void *key)
{ {
unsigned index = ht->hash(ht->cdata, key, ht->bucketBits); unsigned index = ht->hash(ht->cdata, key, ht->bucketBits);
struct xorg_list *bucket = &ht->buckets[index]; struct xorg_list *bucket = &ht->buckets[index];
@ -183,7 +183,7 @@ ht_remove(HashTable ht, pointer key)
} }
pointer pointer
ht_find(HashTable ht, pointer key) ht_find(HashTable ht, const void *key)
{ {
unsigned index = ht->hash(ht->cdata, key, ht->bucketBits); unsigned index = ht->hash(ht->cdata, key, ht->bucketBits);
struct xorg_list *bucket = &ht->buckets[index]; struct xorg_list *bucket = &ht->buckets[index];

View File

@ -75,12 +75,12 @@ extern _X_EXPORT void ht_destroy(HashTable ht);
to avoid returning NULL. Obviously the data pointed cannot be to avoid returning NULL. Obviously the data pointed cannot be
modified, as implied by dataSize being 0. modified, as implied by dataSize being 0.
*/ */
extern _X_EXPORT pointer ht_add(HashTable ht, pointer key); extern _X_EXPORT pointer ht_add(HashTable ht, const void *key);
/** @brief Removes a key from the hash table along with its /** @brief Removes a key from the hash table along with its
associated data, which will be free'd. associated data, which will be free'd.
*/ */
extern _X_EXPORT void ht_remove(HashTable ht, pointer key); extern _X_EXPORT void ht_remove(HashTable ht, const void *key);
/** @brief Finds the associated data of a key from the hash table. /** @brief Finds the associated data of a key from the hash table.
@ -93,7 +93,7 @@ extern _X_EXPORT void ht_remove(HashTable ht, pointer key);
use HtMember instead to determine if a key has been use HtMember instead to determine if a key has been
inserted. inserted.
*/ */
extern _X_EXPORT pointer ht_find(HashTable ht, pointer key); extern _X_EXPORT pointer ht_find(HashTable ht, const void *key);
/** @brief A generic hash function */ /** @brief A generic hash function */
extern _X_EXPORT unsigned ht_generic_hash(void *cdata, extern _X_EXPORT unsigned ht_generic_hash(void *cdata,