diff options
| author | 2022-08-19 06:57:21 +0200 | |
|---|---|---|
| committer | 2022-08-19 06:57:21 +0200 | |
| commit | f64f691a43f474b450f29795b4bc68bc2ef6231e (patch) | |
| tree | 7e949c593a66118d4a8a1043f664e363affa96f8 /src/parse.cff | |
| parent | e07baf707f097434cbe4739d3fcf1bc27a62d587 (diff) | |
take alignment in allocator
Diffstat (limited to 'src/parse.cff')
| -rw-r--r-- | src/parse.cff | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/parse.cff b/src/parse.cff index b42d45a..1449eab 100644 --- a/src/parse.cff +++ b/src/parse.cff @@ -858,7 +858,7 @@ fn typematchestarg(targ *const Type, ty *const Type) bool { } fn exprdup(alloc *Allocator, ex Expr) *Expr { - return memcpy(alloc->alloc(sizeof(ex)), &ex, sizeof(ex)); + return memcpy(alloc->alloc(sizeof(ex), alignof(ex)), &ex, sizeof(ex)); } fn islvalue(ex Expr) bool { @@ -955,7 +955,7 @@ fn mergetoktrees(alloc *Allocator, src *[#]Tok, n int) [#]Tok { ++total; } } - let d *Tok = alloc->alloc(total * sizeof Tok); + let d *Tok = alloc->alloc(total * sizeof Tok, alignof Tok); let len = 0; for let i = 0; i < n; ++i { if i > 0 { @@ -1687,7 +1687,7 @@ fn parseexpr(P *Parser) Expr { //////////////////////// fn stmtdup(alloc *Allocator, st Stmt) *Stmt { - return memcpy(alloc->alloc(sizeof(st)), &st, sizeof(st)); + return memcpy(alloc->alloc(sizeof(st), alignof(st)), &st, sizeof(st)); } typedef StmtYielder *fn(Stmt, *void) void; |