fix(memory): fix memory alignment for dynamic allocation

all pointers returned by arena_alloc residing in arena block should be
properly aligned

to meet neovim's alignment requirements but keeping it simple settle on
ARENA_ALIGN = MAX(sizeof(void *), sizeof(double)).
This commit is contained in:
Jan Palus
2022-10-05 00:18:09 +02:00
committed by bfredl
parent 19dab2ead2
commit 0240fd6d0f
2 changed files with 20 additions and 14 deletions

View File

@@ -45,7 +45,7 @@ typedef struct consumed_blk {
struct consumed_blk *prev;
} *ArenaMem;
#define ARENA_ALIGN sizeof(void *)
#define ARENA_ALIGN MAX(sizeof(void *), sizeof(double))
typedef struct {
char *cur_blk;