Mesa (main): gallium/util/u_cache.c: remove trailing whitespace
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Apr 22 17:20:44 UTC 2022
Module: Mesa
Branch: main
Commit: 1221e678ba409ba9e3abfb51406ef77247a91dcf
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=1221e678ba409ba9e3abfb51406ef77247a91dcf
Author: Dylan Baker <dylan.c.baker at intel.com>
Date: Wed Mar 16 14:12:33 2022 -0700
gallium/util/u_cache.c: remove trailing whitespace
Reviewed-by: Roland Scheidegger <sroland at vmware.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15418>
---
src/gallium/auxiliary/util/u_cache.c | 36 ++++++++++++++++++------------------
1 file changed, 18 insertions(+), 18 deletions(-)
diff --git a/src/gallium/auxiliary/util/u_cache.c b/src/gallium/auxiliary/util/u_cache.c
index c748cb99dd0..6c836231b10 100644
--- a/src/gallium/auxiliary/util/u_cache.c
+++ b/src/gallium/auxiliary/util/u_cache.c
@@ -31,7 +31,7 @@
*
* Fixed size array with linear probing on collision and LRU eviction
* on full.
- *
+ *
* @author Jose Fonseca <jfonseca at vmware.com>
*/
@@ -55,7 +55,7 @@ struct util_cache_entry
void *key;
void *value;
-
+
#ifdef DEBUG
unsigned count;
#endif
@@ -66,7 +66,7 @@ struct util_cache
{
/** Hash function */
uint32_t (*hash)(const void *key);
-
+
/** Compare two keys */
int (*compare)(const void *key1, const void *key2);
@@ -75,10 +75,10 @@ struct util_cache
/** Max entries in the cache */
uint32_t size;
-
+
/** Array [size] of entries */
struct util_cache_entry *entries;
-
+
/** Number of entries in the cache */
unsigned count;
@@ -103,26 +103,26 @@ util_cache_create(uint32_t (*hash)(const void *key),
uint32_t size)
{
struct util_cache *cache;
-
+
cache = CALLOC_STRUCT(util_cache);
if (!cache)
return NULL;
-
+
cache->hash = hash;
cache->compare = compare;
cache->destroy = destroy;
- make_empty_list(&cache->lru);
+ list_inithead(&cache->lru.list);
size *= CACHE_DEFAULT_ALPHA;
cache->size = size;
-
+
cache->entries = CALLOC(size, sizeof(struct util_cache_entry));
if (!cache->entries) {
FREE(cache);
return NULL;
}
-
+
ensure_sanity(cache);
return cache;
}
@@ -174,10 +174,10 @@ util_cache_entry_destroy(struct util_cache *cache,
{
void *key = entry->key;
void *value = entry->value;
-
+
entry->key = NULL;
entry->value = NULL;
-
+
if (entry->state == FILLED) {
remove_from_list(entry);
cache->count--;
@@ -213,11 +213,11 @@ util_cache_set(struct util_cache *cache,
util_cache_entry_destroy(cache, cache->lru.prev);
util_cache_entry_destroy(cache, entry);
-
+
#ifdef DEBUG
++entry->count;
#endif
-
+
entry->key = key;
entry->hash = hash;
entry->value = value;
@@ -259,7 +259,7 @@ util_cache_get(struct util_cache *cache,
* Remove all entries from the cache. The 'destroy' function will be called
* for each entry's (key, value).
*/
-void
+void
util_cache_clear(struct util_cache *cache)
{
uint32_t i;
@@ -297,15 +297,15 @@ util_cache_destroy(struct util_cache *cache)
unsigned i;
for (i = 0; i < cache->size; ++i) {
double z = fabs(cache->entries[i].count - mean)/stddev;
- /* This assert should not fail 99.9999998027% of the times, unless
+ /* This assert should not fail 99.9999998027% of the times, unless
* the hash function is a poor one */
assert(z <= 6.0);
}
}
#endif
-
+
util_cache_clear(cache);
-
+
FREE(cache->entries);
FREE(cache);
}
More information about the mesa-commit
mailing list