]> wimlib.net Git - wimlib/blobdiff - src/lookup_table.c
Initial rewrite of resource code
[wimlib] / src / lookup_table.c
index 064215ec0cf75529de50fe677ea758dbdd2fff5b..9502db4770b110b873a7f574ecca6564a2021132 100644 (file)
@@ -40,7 +40,7 @@ new_lookup_table(size_t capacity)
        struct wim_lookup_table *table;
        struct hlist_head *array;
 
        struct wim_lookup_table *table;
        struct hlist_head *array;
 
-       table = MALLOC(sizeof(struct wim_lookup_table));
+       table = CALLOC(1, sizeof(struct wim_lookup_table));
        if (table) {
                array = CALLOC(capacity, sizeof(array[0]));
                if (array) {
        if (table) {
                array = CALLOC(capacity, sizeof(array[0]));
                if (array) {
@@ -920,3 +920,13 @@ lookup_table_total_stream_size(struct wim_lookup_table *table)
        for_lookup_table_entry(table, lte_add_stream_size, &total_size);
        return total_size;
 }
        for_lookup_table_entry(table, lte_add_stream_size, &total_size);
        return total_size;
 }
+
+void
+lookup_table_free_unhashed_streams(struct wim_lookup_table *table)
+{
+       struct wim_lookup_table_entry *lte, *tmp;
+
+       list_for_each_entry_safe(lte, tmp, table->unhashed_streams, staging_list)
+               free_lookup_table_entry(lte);
+       INIT_LIST_HEAD(table->unhashed_streams);
+}