-/* Decrement the reference count for the dentry having hash value @hash in the
- * lookup table. The lookup table entry is unlinked and freed if there are no
- * references to in remaining. */
-struct lookup_table_entry *
-lookup_table_decrement_refcnt(struct lookup_table* table, const u8 hash[])
-{
- size_t pos = *(size_t*)hash % table->capacity;
- struct lookup_table_entry *prev = NULL;
- struct lookup_table_entry *entry = table->array[pos];
- struct lookup_table_entry *next;
- while (entry) {
- next = entry->next;
- if (memcmp(hash, entry->hash, WIM_HASH_SIZE) == 0) {
- wimlib_assert(entry->refcnt != 0);
- if (--entry->refcnt == 0) {
- if (entry->num_opened_fds == 0) {
- free_lookup_table_entry(entry);
- entry = NULL;
- }
- if (prev)
- prev->next = next;
- else
- table->array[pos] = next;
- break;
- }
- }
- prev = entry;
- entry = next;
- }
- return entry;
-}
-
-/* Like lookup_table_decrement_refcnt(), but for when we already know the lookup
- * table entry. */
+/* Decrements the reference count for the lookup table entry @lte. If its
+ * reference count reaches 0, it is unlinked from the lookup table. If,
+ * furthermore, the entry has no opened file descriptors associated with it, the
+ * entry is freed. */