From be2f307d175b1be9194bf2818801e35e5c4e0500 Mon Sep 17 00:00:00 2001 From: Kristof Szabados <Kristof.Szabados@ericsson.com> Date: Wed, 31 Oct 2018 07:53:17 +0100 Subject: [PATCH] some optimalizations. Signed-off-by: Kristof Szabados <Kristof.Szabados@ericsson.com> --- compiler2/record.c | 6 ++++-- compiler2/record_of.c | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/compiler2/record.c b/compiler2/record.c index 0eed9ea52..0671f8e44 100644 --- a/compiler2/record.c +++ b/compiler2/record.c @@ -3871,7 +3871,8 @@ void defRecordClass1(const struct_def *sdef, output_struct *output) } src = mputprintf(src, " for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {\n" - " param.get_elem(val_idx)->error(\"Non existent field name in type %s: %%s\", param.get_elem(val_idx)->get_id()->get_name());\n" + " Module_Param* const curr_param = param.get_elem(val_idx);\n" + " curr_param->error(\"Non existent field name in type %s: %%s\", curr_param->get_id()->get_name());\n" " break;\n" " }\n" " } break;\n" @@ -6410,7 +6411,8 @@ void defRecordTemplate1(const struct_def *sdef, output_struct *output) } src = mputprintf(src, " for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {\n" - " param.get_elem(val_idx)->error(\"Non existent field name in type %s: %%s\", param.get_elem(val_idx)->get_id()->get_name());\n" + " Module_Param* const curr_param = param.get_elem(val_idx);\n" + " curr_param->error(\"Non existent field name in type %s: %%s\", curr_param->get_id()->get_name());\n" " break;\n" " }\n" " } break;\n" diff --git a/compiler2/record_of.c b/compiler2/record_of.c index 7cee6d807..178b767dc 100644 --- a/compiler2/record_of.c +++ b/compiler2/record_of.c @@ -4564,8 +4564,9 @@ void defRecordOfTemplate1(const struct_of_def *sdef, output_struct *output) " break;\n" " case Module_Param::MP_Permutation_Template: {\n" " int perm_start_idx = curr_idx;\n" - " for (size_t perm_i=0; perm_i<param.get_elem(p_i)->get_size(); perm_i++) {\n" - " (*this)[curr_idx].set_param(*(param.get_elem(p_i)->get_elem(perm_i)));\n" + " Module_Param* param_i = param.get_elem(p_i);\n" + " for (size_t perm_i=0; perm_i<param_i->get_size(); perm_i++) {\n" + " (*this)[curr_idx].set_param(*(param_i->get_elem(perm_i)));\n" " curr_idx++;\n" " }\n" " int perm_end_idx = curr_idx - 1;\n" -- GitLab