From bf1b4ac0c0067a6d19959f1cca962472a6e82810 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Fri, 4 Aug 2023 19:33:55 -0500 Subject: [PATCH] Cleanup: Reduce usage of static in functions. Remove the static from variables in functions that are not likely to be called multiple times and are not expected to be recursive. I am backing off the experiment into this optimization for now. --- level_3/fake/c/main/common.c | 12 ++++++------ level_3/fake/c/main/fake/path_generate.c | 6 +++--- level_3/fss_read/c/main/common.c | 16 ++++++++-------- level_3/fss_write/c/main/common.c | 6 +++--- level_3/iki_read/c/main/common.c | 4 ++-- 5 files changed, 22 insertions(+), 22 deletions(-) diff --git a/level_3/fake/c/main/common.c b/level_3/fake/c/main/common.c index 2e1408c..38489e9 100644 --- a/level_3/fake/c/main/common.c +++ b/level_3/fake/c/main/common.c @@ -106,19 +106,19 @@ extern "C" { uint8_t i = 0; { - static const uint8_t enables[] = { + const uint8_t enables[] = { fake_parameter_documents_enable_e, fake_parameter_shared_enable_e, fake_parameter_static_enable_e, }; - static const uint8_t disables[] = { + const uint8_t disables[] = { fake_parameter_documents_enable_e, fake_parameter_shared_enable_e, fake_parameter_static_enable_e, }; - static const uint16_t flags[] = { + const uint16_t flags[] = { fake_main_flag_enable_documents_e, fake_main_flag_enable_shared_e, fake_main_flag_enable_static_e, @@ -146,7 +146,7 @@ extern "C" { } { - static const f_number_unsigned_t parameters[] = { + const f_number_unsigned_t parameters[] = { fake_parameter_build_e, fake_parameter_data_e, fake_parameter_documents_e, @@ -204,7 +204,7 @@ extern "C" { fake_default_work_s, }; - static const bool cleanups[] = { + const bool cleanups[] = { F_true, // fake_parameter_build_e F_true, // fake_parameter_data_e F_true, // fake_parameter_documents_e @@ -348,7 +348,7 @@ extern "C" { } { - static const f_number_unsigned_t parameters[] = { + const f_number_unsigned_t parameters[] = { fake_parameter_define_e, fake_parameter_mode_e, }; diff --git a/level_3/fake/c/main/fake/path_generate.c b/level_3/fake/c/main/fake/path_generate.c index 7f9dbfb..34c870d 100644 --- a/level_3/fake/c/main/fake/path_generate.c +++ b/level_3/fake/c/main/fake/path_generate.c @@ -22,7 +22,7 @@ extern "C" { main->setting.data, }; - static const uint8_t parameters_size[] = { + const uint8_t parameters_size[] = { 9, 3, }; @@ -121,7 +121,7 @@ extern "C" { data->path_documents, }; - static const uint8_t parameters_size[] = { + const uint8_t parameters_size[] = { 3, 3, 3, @@ -293,7 +293,7 @@ extern "C" { data->path_work_programs, }; - static const uint8_t parameters_size[] = { + const uint8_t parameters_size[] = { 3, 3, }; diff --git a/level_3/fss_read/c/main/common.c b/level_3/fss_read/c/main/common.c index 903a952..c593ff5 100644 --- a/level_3/fss_read/c/main/common.c +++ b/level_3/fss_read/c/main/common.c @@ -143,7 +143,7 @@ extern "C" { } { - static const f_number_unsigned_t parameter_code[] = { + const f_number_unsigned_t parameter_code[] = { fss_read_parameter_at_e, fss_read_parameter_depth_e, fss_read_parameter_line_e, @@ -161,11 +161,11 @@ extern "C" { fss_read_long_delimit_s, }; - static const f_string_static_t message_positive_number = macro_f_string_static_t_initialize_1("a positive number", 0, 17); - static const f_string_static_t message_string = macro_f_string_static_t_initialize_1("a string", 0, 8); - static const f_string_static_t message_value = macro_f_string_static_t_initialize_1("a value", 0, 7); + const f_string_static_t message_positive_number = macro_f_string_static_t_initialize_1("a positive number", 0, 17); + const f_string_static_t message_string = macro_f_string_static_t_initialize_1("a string", 0, 8); + const f_string_static_t message_value = macro_f_string_static_t_initialize_1("a value", 0, 7); - static const f_string_static_t parameter_message[] = { + const f_string_static_t parameter_message[] = { message_positive_number, message_positive_number, message_positive_number, @@ -174,7 +174,7 @@ extern "C" { message_value, }; - static const uint32_t parameter_flag[] = { + const uint32_t parameter_flag[] = { fss_read_main_flag_at_e, fss_read_main_flag_depth_e, fss_read_main_flag_line_e, @@ -224,7 +224,7 @@ extern "C" { } if (parameters->array[fss_read_parameter_columns_e].result & f_console_result_found_e) { - static const f_number_unsigned_t parameter_code[] = { + const f_number_unsigned_t parameter_code[] = { fss_read_parameter_depth_e, fss_read_parameter_line_e, fss_read_parameter_pipe_e, @@ -240,7 +240,7 @@ extern "C" { fss_read_long_total_s, }; - static const uint8_t parameter_match[] = { + const uint8_t parameter_match[] = { f_console_result_value_e, f_console_result_value_e, f_console_result_found_e, diff --git a/level_3/fss_write/c/main/common.c b/level_3/fss_write/c/main/common.c index 1e87b75..a2bf89e 100644 --- a/level_3/fss_write/c/main/common.c +++ b/level_3/fss_write/c/main/common.c @@ -554,13 +554,13 @@ extern "C" { } { - static const uint32_t has[] = { + const uint32_t has[] = { fss_write_parameter_content_end_e, fss_write_parameter_content_next_e, fss_write_parameter_object_open_e, }; - static const uint16_t has_flag[] = { + const uint16_t has_flag[] = { fss_write_main_flag_content_end_e, fss_write_main_flag_content_next_e, fss_write_main_flag_object_open_e, @@ -572,7 +572,7 @@ extern "C" { fss_write_long_object_open_s, }; - static const uint16_t has_cannots[][2] = { + const uint16_t has_cannots[][2] = { { fss_write_parameter_content_next_e, fss_write_parameter_object_open_e }, { fss_write_parameter_content_end_e, fss_write_parameter_object_open_e }, { fss_write_parameter_content_end_e, fss_write_parameter_content_next_e }, diff --git a/level_3/iki_read/c/main/common.c b/level_3/iki_read/c/main/common.c index 97b7e0e..866e6ba 100644 --- a/level_3/iki_read/c/main/common.c +++ b/level_3/iki_read/c/main/common.c @@ -442,7 +442,7 @@ extern "C" { } if (main->program.parameters.array[iki_read_parameter_literal_e].result & f_console_result_found_e) { - static const uint8_t ids[3] = { + const uint8_t ids[3] = { iki_read_parameter_object_e, iki_read_parameter_content_e, iki_read_parameter_total_e, @@ -472,7 +472,7 @@ extern "C" { main->setting.flag |= iki_read_main_flag_literal_e; } else if (main->program.parameters.array[iki_read_parameter_object_e].result & f_console_result_found_e) { - static const uint8_t ids[2] = { + const uint8_t ids[2] = { iki_read_parameter_content_e, iki_read_parameter_total_e, }; -- 1.8.3.1