From 7ea4fb4ca50a3ccc9c0a35eb9940750df3e3f476 Mon Sep 17 00:00:00 2001 From: gambas Date: Wed, 8 May 2019 06:27:14 +0200 Subject: [PATCH] Remove a useless memory allocation in column annotation. The compiler is now just 0.5% slower than before. [COMPILER] * OPT: Remove a useless memory allocation in column annotation. The compiler is now just 0.5% slower than before. --- main/gbc/gbc_trans_expr.c | 2 +- main/gbc/gbc_trans_tree.c | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/main/gbc/gbc_trans_expr.c b/main/gbc/gbc_trans_expr.c index 10979d8e8..4ded080e3 100644 --- a/main/gbc/gbc_trans_expr.c +++ b/main/gbc/gbc_trans_expr.c @@ -888,7 +888,7 @@ static void trans_expression(bool check_statement) JOB->step = JOB_STEP_CODE; FREE(&tree); - FREE(&_tree_pos); + _tree_pos = NULL; _tree_length = 0; if (check_statement) diff --git a/main/gbc/gbc_trans_tree.c b/main/gbc/gbc_trans_tree.c index b07fe93e3..4f5ba5005 100644 --- a/main/gbc/gbc_trans_tree.c +++ b/main/gbc/gbc_trans_tree.c @@ -832,10 +832,7 @@ void TRANS_tree(bool check_statement, TRANS_TREE **result, int *count, int **res ALLOC(result, sizeof(PATTERN) * _tree_length); memcpy(*result, _tree, sizeof(PATTERN) * _tree_length); if (result_pos) - { - ALLOC(result_pos, sizeof(int) * _tree_length); - memcpy(*result_pos, _tree_pos, sizeof(int) * _tree_length); - } + *result_pos = _tree_pos; *count = _tree_length - 1; } }