Mesa (gallium-0.1): gallium: const correctness.
Jose Fonseca
jrfonseca at kemper.freedesktop.org
Mon Dec 22 16:55:18 UTC 2008
Module: Mesa
Branch: gallium-0.1
Commit: ae7e75d6108e8621878083b35a13edc1aca893df
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ae7e75d6108e8621878083b35a13edc1aca893df
Author: José Fonseca <jfonseca at vmware.com>
Date: Mon Dec 22 16:55:27 2008 +0000
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(-)
diff --git a/src/gallium/auxiliary/util/u_cache.c b/src/gallium/auxiliary/util/u_cache.c
index 69a5268..0a1a642 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 835e083..8a612c6 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 508a31f..b67653e 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 76c3513..8d92b07 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
More information about the mesa-commit
mailing list