]> Kevux Git Server - fll/commitdiff
Update: Move the program data into the main for fss_embedded_list_write.
authorKevin Day <thekevinday@gmail.com>
Wed, 30 Mar 2022 04:58:31 +0000 (23:58 -0500)
committerKevin Day <thekevinday@gmail.com>
Wed, 30 Mar 2022 04:58:31 +0000 (23:58 -0500)
Move parameter initialization and deallocation for FLL program data into main.c.

level_3/fss_embedded_list_write/c/common.c
level_3/fss_embedded_list_write/c/common.h
level_3/fss_embedded_list_write/c/fss_embedded_list_write.c
level_3/fss_embedded_list_write/c/fss_embedded_list_write.h
level_3/fss_embedded_list_write/c/main.c
level_3/fss_embedded_list_write/c/private-common.h

index 273ffd009e3f18b0e144a35230bb5e7f8254a18d..9a528ee65a91f534b51b4c7d68d139402f5e274e 100644 (file)
@@ -42,13 +42,6 @@ extern "C" {
   const f_string_static_t fss_embedded_list_write_long_trim_s = macro_f_string_static_t_initialize(FSS_EMBEDDED_LIST_WRITE_long_trim_s, 0, FSS_EMBEDDED_LIST_WRITE_long_trim_s_length);
 #endif // _di_fss_embedded_list_write_parameters_
 
-#ifndef _di_fss_embedded_list_write_main_delete_
-  f_status_t fss_embedded_list_write_main_delete(fll_program_data_t * const main) {
-
-    return fll_program_data_delete(main);
-  }
-#endif // _di_fss_embedded_list_write_main_delete_
-
 #ifdef __cplusplus
 } // extern "C"
 #endif
index b484d1e77d331592c11228d86945bb9b44b04d77..7db129048b0c30e11785072aca1fab564821e0cd 100644 (file)
@@ -201,25 +201,6 @@ extern "C" {
   #define fss_embedded_list_write_total_parameters_d 18
 #endif // _di_fss_embedded_list_write_parameters_
 
-/**
- * Deallocate main.
- *
- * Be sure to call this after executing fss_embedded_list_write_main().
- *
- * @param main
- *   The main program data.
- *
- * @return
- *   F_none on success.
- *
- *   Status codes (with error bit) are returned on any problem.
- *
- * @see fss_embedded_list_write_main()
- */
-#ifndef _di_fss_embedded_list_write_main_delete_
-  extern f_status_t fss_embedded_list_write_main_delete(fll_program_data_t * const main);
-#endif // _di_fss_embedded_list_write_main_delete_
-
 #ifdef __cplusplus
 } // extern "C"
 #endif
index fd9e082397c746cd782ed499488d1b3aeae7f3eb..0d37154f1f4da3b8800e12376d252465789326a0 100644 (file)
@@ -64,10 +64,6 @@ extern "C" {
 
     f_status_t status = F_none;
 
-    f_console_parameter_t parameters[] = fss_embedded_list_write_console_parameter_t_initialize;
-    main->parameters.array = parameters;
-    main->parameters.used = fss_embedded_list_write_total_parameters_d;
-
     {
       f_console_parameter_id_t ids[3] = { fss_embedded_list_write_parameter_no_color_e, fss_embedded_list_write_parameter_light_e, fss_embedded_list_write_parameter_dark_e };
       const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 3);
@@ -94,11 +90,7 @@ extern "C" {
         fll_program_parameter_process_empty(&main->context, sets);
       }
 
-      if (F_status_is_error(status)) {
-        fss_embedded_list_write_main_delete(main);
-
-        return F_status_set_error(status);
-      }
+      if (F_status_is_error(status)) return status;
     }
 
     // Identify priority of verbosity related parameters.
@@ -108,12 +100,7 @@ extern "C" {
       const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 4);
 
       status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
-
-      if (F_status_is_error(status)) {
-        fss_embedded_list_write_main_delete(main);
-
-        return status;
-      }
+      if (F_status_is_error(status)) return status;
 
       if (choice == fss_embedded_list_write_parameter_verbosity_quiet_e) {
         main->output.verbosity = f_console_verbosity_quiet_e;
@@ -144,16 +131,12 @@ extern "C" {
     if (main->parameters.array[fss_embedded_list_write_parameter_help_e].result == f_console_result_found_e) {
       fss_embedded_list_write_print_help(main->output.to, main->context);
 
-      fss_embedded_list_write_main_delete(main);
-
       return status;
     }
 
     if (main->parameters.array[fss_embedded_list_write_parameter_version_e].result == f_console_result_found_e) {
       fll_program_print_version(main->output.to, fss_embedded_list_write_program_version_s);
 
-      fss_embedded_list_write_main_delete(main);
-
       return status;
     }
 
@@ -520,7 +503,6 @@ extern "C" {
     }
 
     f_string_dynamic_resize(0, &buffer);
-    fss_embedded_list_write_main_delete(main);
 
     return status;
   }
index a0d6c38a507983c9b1293bd914367ae2394ddb63..1e9d434365a8553f854c0a38b666c37614ed0ec5 100644 (file)
@@ -84,8 +84,6 @@ extern "C" {
  *   F_none on success.
  *
  *   Status codes (with error bit) are returned on any problem.
- *
- * @see fss_embedded_list_write_main_delete()
  */
 #ifndef _di_fss_embedded_list_write_main_
   extern f_status_t fss_embedded_list_write_main(fll_program_data_t * const main, const f_console_arguments_t *arguments);
index 93a1ca96327d01e9f3174e5a3f0a4632cf48816a..fa25afce0f720e2ca5df10b12cd92d31cac0a7f0 100644 (file)
@@ -5,6 +5,10 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
   const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
   fll_program_data_t data = fll_program_data_t_initialize;
 
+  f_console_parameter_t parameters[] = fss_embedded_list_write_console_parameter_t_initialize;
+  data.parameters.array = parameters;
+  data.parameters.used = fss_embedded_list_write_total_parameters_d;
+
   if (f_pipe_input_exists()) {
     data.process_pipe = F_true;
   }
@@ -13,6 +17,8 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
 
   const f_status_t status = fss_embedded_list_write_main(&data, &arguments);
 
+  fll_program_data_delete(&data);
+
   fll_program_standard_setdown(&data.signal);
 
   if (F_status_is_error(status)) return 1;
index 60f996fea8f098dc38da3606e9c284732cee7c0e..a2920f5842dd0c3b3871abc9d008bd7310c22fbe 100644 (file)
@@ -52,7 +52,7 @@ extern "C" {
  * @see f_signal_read()
  */
 #ifndef _di_fss_embedded_list_write_signal_received_
-  extern f_status_t fss_embedded_list_write_signal_received(fll_program_data_t * const main);
+  extern f_status_t fss_embedded_list_write_signal_received(fll_program_data_t * const main) F_attribute_visibility_internal_d;
 #endif // _di_fss_embedded_list_write_signal_received_
 
 #ifdef __cplusplus