X-Git-Url: https://wimlib.net/git/?a=blobdiff_plain;f=src%2Fdentry.c;h=0e0bfd5df73832c17a39cabd13f9a50d440cf985;hb=bde1c17816c7ed97c236158e2f1359bb34af08bf;hp=9e831858cd9834937dfafc6a0fde629876bd941e;hpb=1b807ffe06fef11d62e6e57d6b21e808a4978750;p=wimlib diff --git a/src/dentry.c b/src/dentry.c index 9e831858..0e0bfd5d 100644 --- a/src/dentry.c +++ b/src/dentry.c @@ -969,13 +969,12 @@ new_dentry_with_inode(const tchar *name, struct wim_dentry **dentry_ret) } int -new_filler_directory(const tchar *name, struct wim_dentry **dentry_ret) +new_filler_directory(struct wim_dentry **dentry_ret) { int ret; struct wim_dentry *dentry; - DEBUG("Creating filler directory \"%"TS"\"", name); - ret = new_dentry_with_inode(name, &dentry); + ret = new_dentry_with_inode(T(""), &dentry); if (ret) return ret; /* Leave the inode number as 0; this is allowed for non @@ -999,10 +998,13 @@ dentry_tree_clear_inode_visited(struct wim_dentry *root) for_dentry_in_tree(root, dentry_clear_inode_visited, NULL); } -/* Frees a WIM dentry. +/* + * Free a WIM dentry. * - * The corresponding inode (if any) is freed only if its link count is - * decremented to 0. */ + * In addition to freeing the dentry itself, this decrements the link count of + * the corresponding inode (if any). If the inode's link count reaches 0, the + * inode is freed as well. + */ void free_dentry(struct wim_dentry *dentry) { @@ -1023,16 +1025,8 @@ do_free_dentry(struct wim_dentry *dentry, void *_lookup_table) { struct wim_lookup_table *lookup_table = _lookup_table; - if (lookup_table) { - struct wim_inode *inode = dentry->d_inode; - for (unsigned i = 0; i <= inode->i_num_ads; i++) { - struct wim_lookup_table_entry *lte; - - lte = inode_stream_lte(inode, i, lookup_table); - if (lte) - lte_decrement_refcnt(lte, lookup_table); - } - } + if (lookup_table) + inode_unref_streams(dentry->d_inode, lookup_table); free_dentry(dentry); return 0; }