From ae7e75d6108e8621878083b35a13edc1aca893df Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Mon, 22 Dec 2008 16:55:27 +0000 Subject: gallium: const correctness. --- src/gallium/auxiliary/util/u_cache.c | 16 ++++++++-------- src/gallium/auxiliary/util/u_cache.h | 14 +++++++------- src/gallium/auxiliary/util/u_hash.c | 4 ++-- src/gallium/auxiliary/util/u_hash.h | 2 +- 4 files changed, 18 insertions(+), 18 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/util/u_cache.c b/src/gallium/auxiliary/util/u_cache.c index 69a52687fb..0a1a64259f 100644 --- a/src/gallium/auxiliary/util/u_cache.c +++ b/src/gallium/auxiliary/util/u_cache.c @@ -57,10 +57,10 @@ struct util_cache_entry struct util_cache { /** Hash function */ - uint32_t (*hash)(void *key); + uint32_t (*hash)(const void *key); /** Compare two keys */ - int (*compare)(void *key1, void *key2); + int (*compare)(const void *key1, const void *key2); /** Destroy a (key, value) pair */ void (*destroy)(void *key, void *value); @@ -76,10 +76,10 @@ struct util_cache struct util_cache * -util_cache_create(uint32_t (*hash)(void *key), - int (*compare)(void *key1, void *key2), - void (*destroy)(void *key, void *value), - uint32_t size) +util_cache_create(uint32_t (*hash)(const void *key), + int (*compare)(const void *key1, const void *key2), + void (*destroy)(void *key, void *value), + uint32_t size) { struct util_cache *cache; @@ -104,7 +104,7 @@ util_cache_create(uint32_t (*hash)(void *key), static INLINE struct util_cache_entry * util_cache_entry_get(struct util_cache *cache, - void *key) + const void *key) { uint32_t hash; @@ -153,7 +153,7 @@ util_cache_set(struct util_cache *cache, void * util_cache_get(struct util_cache *cache, - void *key) + const void *key) { struct util_cache_entry *entry; diff --git a/src/gallium/auxiliary/util/u_cache.h b/src/gallium/auxiliary/util/u_cache.h index 835e083734..8a612c6585 100644 --- a/src/gallium/auxiliary/util/u_cache.h +++ b/src/gallium/auxiliary/util/u_cache.h @@ -59,19 +59,19 @@ struct util_cache; * @param size maximum number of entries */ struct util_cache * -util_cache_create(uint32_t (*hash)(void *key), - int (*compare)(void *key1, void *key2), - void (*destroy)(void *key, void *value), - uint32_t size); +util_cache_create(uint32_t (*hash)(const void *key), + int (*compare)(const void *key1, const void *key2), + void (*destroy)(void *key, void *value), + uint32_t size); void util_cache_set(struct util_cache *cache, - void *key, - void *value); + void *key, + void *value); void * util_cache_get(struct util_cache *cache, - void *key); + const void *key); void util_cache_clear(struct util_cache *cache); diff --git a/src/gallium/auxiliary/util/u_hash.c b/src/gallium/auxiliary/util/u_hash.c index 508a31f2cb..b67653ec70 100644 --- a/src/gallium/auxiliary/util/u_hash.c +++ b/src/gallium/auxiliary/util/u_hash.c @@ -36,7 +36,7 @@ #include "u_hash.h" -static uint32_t +static const uint32_t util_crc32_table[256] = { 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, @@ -109,7 +109,7 @@ util_crc32_table[256] = { * @sa http://www.w3.org/TR/PNG/#D-CRCAppendix */ uint32_t -util_hash_crc32(void *data, size_t size) +util_hash_crc32(const void *data, size_t size) { uint8_t *p = (uint8_t *)data; uint32_t crc = 0xffffffff; diff --git a/src/gallium/auxiliary/util/u_hash.h b/src/gallium/auxiliary/util/u_hash.h index 76c3513e4a..8d92b07c85 100644 --- a/src/gallium/auxiliary/util/u_hash.h +++ b/src/gallium/auxiliary/util/u_hash.h @@ -45,7 +45,7 @@ extern "C" { uint32_t -util_hash_crc32(void *data, size_t size); +util_hash_crc32(const void *data, size_t size); #ifdef __cplusplus -- cgit v1.2.3