X-Git-Url: https://wimlib.net/git/?a=blobdiff_plain;f=src%2Flookup_table.c;h=d3ed585445a225f53b91e82e7d437d127f9560ee;hb=5e770a99c374e24bf2a174e0fb675aaa57df0af4;hp=bb6e2b52e27d9866e462b9368d424f1b1f1effaf;hpb=b8dd0c7d735c9e7db3f190a284a6255dab10ef1b;p=wimlib diff --git a/src/lookup_table.c b/src/lookup_table.c index bb6e2b52..d3ed5854 100644 --- a/src/lookup_table.c +++ b/src/lookup_table.c @@ -70,6 +70,15 @@ struct lookup_table_entry *new_lookup_table_entry() } +void free_lookup_table_entry(struct lookup_table_entry *lte) +{ + if (lte) { + if (lte->staging_list.next) + list_del(<e->staging_list); + FREE(lte->file_on_disk); + FREE(lte); + } +} /* * Inserts an entry into the lookup table. @@ -362,11 +371,12 @@ int lookup_resource(WIMStruct *w, const char *path, int lookup_flags, struct dentry **dentry_ret, struct lookup_table_entry **lte_ret, - u8 **hash_ret) + unsigned *stream_idx_ret) { struct dentry *dentry = get_dentry(w, path); struct lookup_table_entry *lte; - u8 *hash; + unsigned stream_idx = 0; + const u8 *hash = dentry->hash; if (!dentry) return -ENOENT; if (!(lookup_flags & LOOKUP_FLAG_DIRECTORY_OK) @@ -381,6 +391,7 @@ int lookup_resource(WIMStruct *w, const char *path, stream_name, stream_name_len)) { + stream_idx = i + 1; hash = dentry->ads_entries[i].hash; goto do_lookup; } @@ -388,14 +399,13 @@ int lookup_resource(WIMStruct *w, const char *path, return -ENOENT; } } - hash = dentry->hash; do_lookup: lte = __lookup_resource(w->lookup_table, hash); if (dentry_ret) *dentry_ret = dentry; if (lte_ret) *lte_ret = lte; - if (hash_ret) - *hash_ret = hash; + if (stream_idx_ret) + *stream_idx_ret = stream_idx; return 0; }