diff options
author | Alex Corscadden <[email protected]> | 2011-01-06 10:59:13 -0800 |
---|---|---|
committer | José Fonseca <[email protected]> | 2011-03-09 11:16:49 +0000 |
commit | d00cbf46cde0edee6d8f2c08e14458ef92ff0fbe (patch) | |
tree | c94912243548d0bd3213db56980532f40c9a5553 /src/gallium/auxiliary/util/u_cache.c | |
parent | eb2e8167fa543d12bac91e451838934ebbf0d594 (diff) |
util: Add remove to util_cache
I need to be able to remove entries from util_cache caches. This change
enables that functionality.
Diffstat (limited to 'src/gallium/auxiliary/util/u_cache.c')
-rw-r--r-- | src/gallium/auxiliary/util/u_cache.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/util/u_cache.c b/src/gallium/auxiliary/util/u_cache.c index 15f4a8831f2..e88f36dea75 100644 --- a/src/gallium/auxiliary/util/u_cache.c +++ b/src/gallium/auxiliary/util/u_cache.c @@ -215,3 +215,25 @@ util_cache_destroy(struct util_cache *cache) FREE(cache->entries); FREE(cache); } + + +void +util_cache_remove(struct util_cache *cache, + const void *key) +{ + struct util_cache_entry *entry; + uint32_t hash; + + assert(cache); + if (!cache) + return; + + hash = cache->hash(key); + + entry = util_cache_entry_get(cache, hash, key); + if (!entry) + return; + + if (entry->state == FILLED) + util_cache_entry_destroy(cache, entry); +} |