dedup

data deduplication program
git clone git://git.2f30.org/dedup.git
Log | Files | Refs | README | LICENSE

commit 893e7bbe929d2b1aa1f711eeedec9f1e022a651f
parent 8f41ac4be4b5c594892b1be8847706db16405c25
Author: sin <sin@2f30.org>
Date:   Mon, 25 Feb 2019 14:03:03 +0000

Rename cache->entries to cache->nodes

Diffstat:
Mcache.c | 14+++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/cache.c b/cache.c @@ -17,7 +17,7 @@ struct cache_node { RB_HEAD(cache_head, cache_node); struct cache { - struct cache_head entries; + struct cache_head nodes; }; static int @@ -59,7 +59,7 @@ add_cache_entry(struct cache *cache, struct cache_entry *ent) struct cache_node *node; node = alloc_cache_node(ent); - RB_INSERT(cache_head, &cache->entries, node); + RB_INSERT(cache_head, &cache->nodes, node); } int @@ -68,7 +68,7 @@ lookup_cache_entry(struct cache *cache, struct cache_entry *ent) struct cache_node *node, key; key.ent = *ent; - node = RB_FIND(cache_head, &cache->entries, &key); + node = RB_FIND(cache_head, &cache->nodes, &key); if (node != NULL) { *ent = node->ent; return 0; @@ -81,7 +81,7 @@ walk_cache(struct cache *cache, int (*fn)(struct cache_entry *)) { struct cache_node *node; - RB_FOREACH(node, cache_head, &cache->entries) + RB_FOREACH(node, cache_head, &cache->nodes) (*fn)(&node->ent); } @@ -93,7 +93,7 @@ alloc_cache(void) cache = calloc(1, sizeof(*cache)); if (cache == NULL) err(1, "malloc"); - RB_INIT(&cache->entries); + RB_INIT(&cache->nodes); return cache; } @@ -102,8 +102,8 @@ free_cache(struct cache *cache) { struct cache_node *node, *tmp; - RB_FOREACH_SAFE(node, cache_head, &cache->entries, tmp) { - RB_REMOVE(cache_head, &cache->entries, node); + RB_FOREACH_SAFE(node, cache_head, &cache->nodes, tmp) { + RB_REMOVE(cache_head, &cache->nodes, node); free_cache_node(node); } free(cache);