Thread: Why not align item size in dshash_table?

Why not align item size in dshash_table?

From
Hao Zhang
Date:
Hi hackers,
I found that the entry size is not aligned with MAXALIGN, but dshash_table_item did that in dshash_table. IMHO, both entry size and dshash_table_item should be aligned with MAXALIGN.

static dshash_table_item *
insert_into_bucket(dshash_table *hash_table,
const void *key,
dsa_pointer *bucket)
{
dsa_pointer item_pointer;
dshash_table_item *item;

item_pointer = dsa_allocate(hash_table->area,
hash_table->params.entry_size +
MAXALIGN(sizeof(dshash_table_item)));
item = dsa_get_address(hash_table->area, item_pointer);
copy_key(hash_table, ENTRY_FROM_ITEM(item), key);
insert_item_into_bucket(hash_table, item_pointer, item, bucket);
return item;
}

With regards,
Hao Zhang