]> Kevux Git Server - fll/commitdiff
Cleanup: Tweak the delimits behavior to re-use the existing array to reduce memory...
authorKevin Day <thekevinday@gmail.com>
Mon, 18 Jul 2022 01:36:45 +0000 (20:36 -0500)
committerKevin Day <thekevinday@gmail.com>
Mon, 18 Jul 2022 01:36:45 +0000 (20:36 -0500)
level_3/fake/c/private-fake.c
level_3/fake/c/private-make-load_fakefile.c

index 4cfc06ddce476abeda81f34263ef659598f5a6c2..7b6ef8bfac7a14d4e3381b2a7f2c06e80e743ba6 100644 (file)
@@ -175,7 +175,7 @@ extern "C" {
 
     do {
       if (fll_program_standard_signal_received(data->main)) {
-        f_string_dynamic_resize(0, buffer);
+        buffer->used = 0;
 
         fake_print_signal_received(data);
 
@@ -189,7 +189,7 @@ extern "C" {
     if (F_status_is_error(status)) {
       fll_error_file_print(data->main->error, F_status_set_fine(status), "f_file_stream_read_block", F_true, f_string_ascii_minus_s, f_file_operation_read_s, fll_error_file_type_file_e);
 
-      f_string_dynamic_resize(0, buffer);
+      buffer->used = 0;
     }
 
     return status;
index 32de47b9b3518d61ca4bc4cd6f8fbd6a882c6bb7..18e3f4fd51e70b4de09d33dc13a8f5be6410d49e 100644 (file)
@@ -50,10 +50,10 @@ extern "C" {
 
     f_fss_objects_t list_objects = f_fss_objects_t_initialize;
     f_fss_contents_t list_contents = f_fss_contents_t_initialize;
+    f_fss_delimits_t delimits = f_fss_delimits_t_initialize;
 
     {
       f_string_range_t range = macro_f_string_range_t_initialize2(data_make->buffer.used);
-      f_fss_delimits_t delimits = f_fss_delimits_t_initialize;
       f_fss_comments_t comments = f_fss_comments_t_initialize;
       f_state_t state = macro_f_state_t_initialize(fake_common_allocation_large_d, fake_common_allocation_small_d, 0, 0, &fll_program_standard_signal_state, 0, (void *) data_make->main, 0);
 
@@ -68,14 +68,16 @@ extern "C" {
         if (F_status_is_error(*status)) {
           fll_error_print(data_make->main->error, F_status_set_fine(*status), "f_fss_apply_delimit", F_true);
         }
+
+        delimits.used = 0;
       }
 
-      macro_f_fss_delimits_t_delete_simple(delimits);
       macro_f_fss_comments_t_delete_simple(comments);
 
       if (F_status_is_error(*status)) {
         macro_f_fss_objects_t_delete_simple(list_objects);
         macro_f_fss_contents_t_delete_simple(list_contents);
+        macro_f_fss_delimits_t_delete_simple(delimits);
 
         return;
       }
@@ -86,7 +88,6 @@ extern "C" {
       bool missing_settings = F_true;
 
       f_fss_set_t settings = f_fss_set_t_initialize;
-
       f_state_t state = macro_f_state_t_initialize(fake_common_allocation_large_d, fake_common_allocation_small_d, 0, 0, &fll_program_standard_signal_state, 0, (void *) data_make->main, 0);
 
       if (list_objects.used > data_make->fakefile.size) {
@@ -99,13 +100,13 @@ extern "C" {
         macro_f_fss_set_t_delete_simple(settings);
         macro_f_fss_objects_t_delete_simple(list_objects);
         macro_f_fss_contents_t_delete_simple(list_contents);
+        macro_f_fss_delimits_t_delete_simple(delimits);
 
         return;
       }
 
       {
         f_string_range_t content_range = f_string_range_t_initialize;
-        f_fss_delimits_t delimits = f_fss_delimits_t_initialize;
 
         for (f_array_length_t i = 0; i < list_objects.used; ++i) {
 
@@ -189,12 +190,11 @@ extern "C" {
 
           ++data_make->fakefile.used;
         } // for
-
-        macro_f_fss_delimits_t_delete_simple(delimits);
       }
 
       macro_f_fss_objects_t_delete_simple(list_objects);
       macro_f_fss_contents_t_delete_simple(list_contents);
+      macro_f_fss_delimits_t_delete_simple(delimits);
 
       if (F_status_is_error(*status)) {
         macro_f_fss_set_t_delete_simple(settings);