hyc

Hydrogen Compiler written in C
git clone git://git.kocotian.pl/hyc.git
Log | Files | Refs | README | LICENSE

commit 852a53115dd297b5ed6a05f7ac37ec1afe4c2c48
parent 57ebabe95de124d41c4cf4efea4ebf5fbd414741
Author: kocotian <kocotian@kocotian.pl>
Date:   Mon, 26 Jul 2021 14:24:19 +0000

Used new() macro instead of mallocing

Diffstat:
Mast.c | 7++-----
1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/ast.c b/ast.c @@ -165,11 +165,8 @@ tokenstoASTStatementConditional(Tokenizer *t) if (Strccmp(tok->str, "if")) error(tok, "expected 'if' keyword"); - *(stat.Conditional.condition = malloc(sizeof *stat.Conditional.condition)) - = tokenstoASTExpression(t); - - *(stat.Conditional.body = malloc(sizeof *stat.Conditional.body)) - = tokenstoASTStatement(t); + new(stat.Conditional.condition) = tokenstoASTExpression(t); + new(stat.Conditional.body) = tokenstoASTStatement(t); return stat; }