mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-12-22 09:41:54 +00:00
Lib: Update alignment of slabs
Alignment of slabs should be at least sizeof(ptr) to avoid unaligned pointers in slab structures. Fixme: Use proper way to choose alignment for internal allocators.
This commit is contained in:
parent
53a2540687
commit
edc1a24017
@ -195,8 +195,8 @@ sl_new(pool *p, uint size)
|
||||
{
|
||||
slab *s = ralloc(p, &sl_class);
|
||||
uint align = sizeof(struct sl_alignment);
|
||||
if (align < sizeof(int))
|
||||
align = sizeof(int);
|
||||
if (align < sizeof(void *))
|
||||
align = sizeof(void *);
|
||||
s->data_size = size;
|
||||
size = (size + align - 1) / align * align;
|
||||
s->obj_size = size;
|
||||
|
Loading…
Reference in New Issue
Block a user