gallium: const correctness.
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user