From 55036f0312af732ff81d9e49cf6a92e3c169e995 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Thu, 7 Apr 2022 20:13:39 -0500 Subject: [PATCH] Cleanup: Code structure for fake. --- level_3/fake/c/private-fake.c | 14 ++++++++------ level_3/fake/c/private-make-load_fakefile.c | 3 ++- level_3/fake/c/private-make.c | 16 ++++++++++++---- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/level_3/fake/c/private-fake.c b/level_3/fake/c/private-fake.c index 442484a..9b4fb88 100644 --- a/level_3/fake/c/private-fake.c +++ b/level_3/fake/c/private-fake.c @@ -199,7 +199,8 @@ extern "C" { return F_status_set_error(F_parameter); } - else if (data->main->parameters.array[parameters_id[i]].result == f_console_result_additional_e) { + + if (data->main->parameters.array[parameters_id[i]].result == f_console_result_additional_e) { if (data->main->parameters.array[parameters_id[i]].locations.used > 1) { fake_print_error_parameter_too_many(data, parameters_name[i]); @@ -279,9 +280,8 @@ extern "C" { return status; } - else { - status = F_none; - } + + status = F_none; } if (!data->main->parameters.arguments.array[index].used || status == F_data_not) { @@ -356,7 +356,8 @@ extern "C" { return F_status_set_error(F_parameter); } - else if (data->main->parameters.array[parameters_id[i]].result == f_console_result_additional_e) { + + if (data->main->parameters.array[parameters_id[i]].result == f_console_result_additional_e) { if (data->main->parameters.array[parameters_id[i]].values.used > 1) { fake_print_error_parameter_too_many(data, parameters_name[i]); @@ -444,7 +445,8 @@ extern "C" { return F_status_set_error(F_parameter); } - else if (data->main->parameters.array[fake_parameter_mode_e].result == f_console_result_additional_e) { + + if (data->main->parameters.array[fake_parameter_mode_e].result == f_console_result_additional_e) { status = fll_program_parameter_additional_rip(data->main->parameters.arguments.array, data->main->parameters.array[fake_parameter_mode_e].values, &data->mode); if (F_status_is_error(status)) { diff --git a/level_3/fake/c/private-make-load_fakefile.c b/level_3/fake/c/private-make-load_fakefile.c index 9a12fc0..69a802b 100644 --- a/level_3/fake/c/private-make-load_fakefile.c +++ b/level_3/fake/c/private-make-load_fakefile.c @@ -152,7 +152,8 @@ extern "C" { continue; } - else if (fl_string_dynamic_partial_compare_string(fake_make_section_main_s.string, data_make->buffer, fake_make_section_main_s.used, list_objects.array[i]) == F_equal_to) { + + if (fl_string_dynamic_partial_compare_string(fake_make_section_main_s.string, data_make->buffer, fake_make_section_main_s.used, list_objects.array[i]) == F_equal_to) { if (!missing_main) { fake_print_warning_settings_object_multiple(data_make->data, data_make->data->file_data_build_fakefile, fake_common_setting_list_s, fake_make_section_main_s); diff --git a/level_3/fake/c/private-make.c b/level_3/fake/c/private-make.c index 5df2e2d..71255c8 100644 --- a/level_3/fake/c/private-make.c +++ b/level_3/fake/c/private-make.c @@ -65,7 +65,8 @@ extern "C" { return F_status_set_error(status); } - else if (status == F_exist_not) { + + if (status == F_exist_not) { if (data->main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(data->main->error.to.stream); @@ -83,9 +84,11 @@ extern "C" { } fll_error_print(print, F_status_set_fine(status), "fl_conversion_dynamic_to_number_unsigned", F_true); + return F_status_set_error(status); } - else if (number > F_type_size_32_unsigned_d) { + + if (number > F_type_size_32_unsigned_d) { if (data->main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(data->main->error.to.stream); @@ -98,6 +101,7 @@ extern "C" { } *id = (gid_t) number; + return status; } #endif // _di_fake_make_get_id_group_ @@ -154,7 +158,8 @@ extern "C" { return F_status_set_error(status); } - else if (status == F_exist_not) { + + if (status == F_exist_not) { if (data->main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(data->main->error.to.stream); @@ -172,9 +177,11 @@ extern "C" { } fll_error_print(print, status, "fl_conversion_dynamic_to_number_unsigned", F_true); + return F_status_set_error(status); } - else if (number > F_type_size_32_unsigned_d) { + + if (number > F_type_size_32_unsigned_d) { if (data->main->error.verbosity != f_console_verbosity_quiet_e) { flockfile(data->main->error.to.stream); @@ -187,6 +194,7 @@ extern "C" { } *id = (uid_t) number; + return status; } #endif // _di_fake_make_get_id_owner_ -- 1.8.3.1