#include "wimlib/blob_table.h"
#include "wimlib/encoding.h"
#include "wimlib/endianness.h"
#include "wimlib/blob_table.h"
#include "wimlib/encoding.h"
#include "wimlib/endianness.h"
struct blob_table *
new_blob_table(size_t capacity)
{
struct blob_table *table;
struct hlist_head *array;
struct blob_table *
new_blob_table(size_t capacity)
{
struct blob_table *table;
struct hlist_head *array;
new_capacity = old_capacity * 2;
new_array = CALLOC(new_capacity, sizeof(struct hlist_head));
if (new_array == NULL)
return;
old_array = table->array;
table->array = new_array;
new_capacity = old_capacity * 2;
new_array = CALLOC(new_capacity, sizeof(struct hlist_head));
if (new_array == NULL)
return;
old_array = table->array;
table->array = new_array;
for (i = 0; i < old_capacity; i++)
hlist_for_each_entry_safe(blob, tmp, &old_array[i], hash_list)
for (i = 0; i < old_capacity; i++)
hlist_for_each_entry_safe(blob, tmp, &old_array[i], hash_list)
blob_table_insert(struct blob_table *table, struct blob_descriptor *blob)
{
blob_table_insert_raw(table, blob);
blob_table_insert(struct blob_table *table, struct blob_descriptor *blob)
{
blob_table_insert_raw(table, blob);
hlist_for_each_entry(blob, &table->array[i], hash_list)
if (hashes_equal(hash, blob->hash))
return blob;
hlist_for_each_entry(blob, &table->array[i], hash_list)
if (hashes_equal(hash, blob->hash))
return blob;
hlist_for_each_entry_safe(blob, tmp, &table->array[i],
hash_list)
{
hlist_for_each_entry_safe(blob, tmp, &table->array[i],
hash_list)
{
/* Allocate a hash table to map SHA-1 message digests into blob
* descriptors. This is the in-memory "blob table". */
/* Allocate a hash table to map SHA-1 message digests into blob
* descriptors. This is the in-memory "blob table". */