]> Kevux Git Server - fll/commitdiff
Cleanup: Reduce usage of static in functions.
authorKevin Day <kevin@kevux.org>
Sat, 5 Aug 2023 00:33:55 +0000 (19:33 -0500)
committerKevin Day <kevin@kevux.org>
Sat, 5 Aug 2023 00:33:55 +0000 (19:33 -0500)
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
level_3/fake/c/main/fake/path_generate.c
level_3/fss_read/c/main/common.c
level_3/fss_write/c/main/common.c
level_3/iki_read/c/main/common.c

index 2e1408cbd836a4d74678266042fa28c2ba802151..38489e9ab7cc715999c22508f87557250dce0250 100644 (file)
@@ -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,
         };
index 7f9dbfb79938446ab9f27a652df9100115d7608a..34c870d407fb9827cb65d3a762bd61ae881f204e 100644 (file)
@@ -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,
         };
index 903a9527cddd4fc437c071dc61df58ce3de99bee..c593ff5e1aa549cbc903bdde05618f2e0af7dc9d 100644 (file)
@@ -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,
index 1e87b75480d0e0c6116aac8f934558a08aa8f8f2..a2bf89e06078a81231a7de929ff65624e9bd12d7 100644 (file)
@@ -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 },
index 97b7e0e1096c140f80a3e026b460f67b6ede5919..866e6bad74daa1c3ac5c3a7fbf5855b6a0069265 100644 (file)
@@ -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,
       };