diff options
author | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2022-02-07 04:39:49 +0100 |
---|---|---|
committer | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2022-02-07 04:39:49 +0100 |
commit | edc1a2401752c3db30df1b9c6c796c06a8c59cc1 (patch) | |
tree | 446bb450a386a56028f6f8c459097ba628ef56be /lib/slab.c | |
parent | 53a25406878ed686a58ec3e7379d6cb45b784942 (diff) |
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.
Diffstat (limited to 'lib/slab.c')
-rw-r--r-- | lib/slab.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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; |