From 0bd27cbaec56d71b2525c2b37ae209396c65d45b Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Sat, 28 Sep 2019 17:38:44 +0200 Subject: Add recoding implementation for the xattr writer This commit implements the part of the API responsible for recoding and deduplicating xattr key-value blocks. Signed-off-by: David Oberhollenzer --- lib/util/str_table.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib/util') diff --git a/lib/util/str_table.c b/lib/util/str_table.c index dba61fe..34aa70e 100644 --- a/lib/util/str_table.c +++ b/lib/util/str_table.c @@ -176,6 +176,14 @@ void str_table_add_ref(str_table_t *table, size_t index) bucket->refcount += 1; } +void str_table_del_ref(str_table_t *table, size_t index) +{ + str_bucket_t *bucket = bucket_by_index(table, index); + + if (bucket != NULL && bucket->refcount > 0) + bucket->refcount -= 1; +} + size_t str_table_get_ref_count(str_table_t *table, size_t index) { str_bucket_t *bucket = bucket_by_index(table, index); -- cgit v1.2.3