1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (C) 2024 Google LLC
6 #include "gendwarfksyms.h"
11 struct hlist_node hash;
14 void cache_set(struct cache *cache, unsigned long key, int value)
16 struct cache_item *ci;
18 ci = xmalloc(sizeof(struct cache_item));
21 hash_add(cache->cache, &ci->hash, hash_32(key));
24 int cache_get(struct cache *cache, unsigned long key)
26 struct cache_item *ci;
28 hash_for_each_possible(cache->cache, ci, hash, hash_32(key)) {
36 void cache_init(struct cache *cache)
38 hash_init(cache->cache);
41 void cache_free(struct cache *cache)
43 struct hlist_node *tmp;
44 struct cache_item *ci;
46 hash_for_each_safe(cache->cache, ci, tmp, hash) {
50 hash_init(cache->cache);