From 7137446817dcb26512b2cab2746fbc5198c93e4d Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Sat, 30 Jul 2022 23:20:04 -0500 Subject: [PATCH] Cleanup: Add missing return statements and remove unused variables. --- level_3/controller/c/entry/private-entry.c | 2 ++ level_3/controller/c/rule/private-rule.c | 2 -- level_3/controller/c/thread/private-thread_process.c | 2 -- level_3/fake/c/fake.c | 2 +- level_3/fake/c/private-make-operate_validate_type.c | 2 ++ level_3/firewall/c/private-firewall.c | 12 +----------- level_3/iki_read/c/private-read.c | 3 --- level_3/utf8/c/private-print.c | 2 -- 8 files changed, 6 insertions(+), 21 deletions(-) diff --git a/level_3/controller/c/entry/private-entry.c b/level_3/controller/c/entry/private-entry.c index e46955c..36a9435 100644 --- a/level_3/controller/c/entry/private-entry.c +++ b/level_3/controller/c/entry/private-entry.c @@ -2315,6 +2315,8 @@ extern "C" { if (F_status_is_error(status)) return status; ++setting_maps->used; + + return F_none; } #endif // _di_controller_entry_settings_read_map_ diff --git a/level_3/controller/c/rule/private-rule.c b/level_3/controller/c/rule/private-rule.c index 2b2b81b..ce0ee4c 100644 --- a/level_3/controller/c/rule/private-rule.c +++ b/level_3/controller/c/rule/private-rule.c @@ -969,8 +969,6 @@ extern "C" { f_string_maps_t environment = f_string_maps_t_initialize; - const f_string_dynamics_t arguments_none = f_string_dynamics_t_initialize; - controller_execute_set_t execute_set = macro_controller_execute_set_t_initialize(0, 0, &environment, &signals, 0, fl_execute_as_t_initialize); if (process->rule.affinity.used) { diff --git a/level_3/controller/c/thread/private-thread_process.c b/level_3/controller/c/thread/private-thread_process.c index dfed74b..29f5444 100644 --- a/level_3/controller/c/thread/private-thread_process.c +++ b/level_3/controller/c/thread/private-thread_process.c @@ -73,8 +73,6 @@ extern "C" { f_thread_mutex_unlock(&global.thread->lock.alert); } - f_array_length_t spent = 0; - struct timespec time; controller_entry_t *entry = 0; diff --git a/level_3/fake/c/fake.c b/level_3/fake/c/fake.c index 6c8f973..4b3c642 100644 --- a/level_3/fake/c/fake.c +++ b/level_3/fake/c/fake.c @@ -283,7 +283,7 @@ extern "C" { } if (F_status_is_error_not(status) && main->process_pipe) { - if (operations_length > 1 || operations[0] != fake_operation_make_e) { + if (operations_length > 1 || operations_length && operations[0] != fake_operation_make_e) { status = F_status_set_error(F_parameter); if (main->error.verbosity != f_console_verbosity_quiet_e) { diff --git a/level_3/fake/c/private-make-operate_validate_type.c b/level_3/fake/c/private-make-operate_validate_type.c index c40b377..9e78e01 100644 --- a/level_3/fake/c/private-make-operate_validate_type.c +++ b/level_3/fake/c/private-make-operate_validate_type.c @@ -233,6 +233,8 @@ extern "C" { return F_status_set_error(F_failure); } + + return F_none; } #endif // _di_fake_make_operate_validate_type_compile_ diff --git a/level_3/firewall/c/private-firewall.c b/level_3/firewall/c/private-firewall.c index bccfe59..e9450ce 100644 --- a/level_3/firewall/c/private-firewall.c +++ b/level_3/firewall/c/private-firewall.c @@ -14,7 +14,6 @@ f_status_t firewall_perform_commands(firewall_data_t * const data, firewall_loca bool is_ip_list = F_false; // Iptables command arguments - bool device_all = F_false; bool ip_list_direction = F_false; // false = source, true = destination. bool use_protocol = F_false; uint8_t tool = firewall_program_ip46tables_e; @@ -37,10 +36,7 @@ f_status_t firewall_perform_commands(firewall_data_t * const data, firewall_loca f_string_dynamic_t protocol = f_string_dynamic_t_initialize; f_string_dynamics_t arguments = f_string_dynamics_t_initialize; - if (local->is_global) { - device_all = F_true; - } - else { + if (!local->is_global) { if (data->devices.array[local->device].used) { device.used = 0; @@ -159,8 +155,6 @@ f_status_t firewall_perform_commands(firewall_data_t * const data, firewall_loca else if (fl_string_dynamic_compare_string(local->buffer.string + local->rule_contents.array[i].array[0].start, firewall_device_all_s, length) == F_equal_to) { f_string_dynamic_resize(0, &device); - device_all = F_true; - continue; } else if (fl_string_dynamic_compare_string(local->buffer.string + local->rule_contents.array[i].array[0].start, firewall_device_this_s, length) == F_equal_to) { @@ -178,8 +172,6 @@ f_status_t firewall_perform_commands(firewall_data_t * const data, firewall_loca f_string_dynamic_resize(0, &device); } - device_all = F_false; - continue; } @@ -192,8 +184,6 @@ f_status_t firewall_perform_commands(firewall_data_t * const data, firewall_loca if (F_status_is_error(status)) break; } - device_all = F_false; - continue; } } diff --git a/level_3/iki_read/c/private-read.c b/level_3/iki_read/c/private-read.c index 0c7046e..79b2b32 100644 --- a/level_3/iki_read/c/private-read.c +++ b/level_3/iki_read/c/private-read.c @@ -348,12 +348,9 @@ extern "C" { f_string_dynamics_t names = f_string_dynamics_t_initialize; f_string_range_t name_range = f_string_range_t_initialize; - f_string_range_t substitution_range = f_string_range_t_initialize; bool name_missed = F_true; - substitution_range.start = 0; - if (data->main->parameters.array[iki_read_parameter_name_e].result == f_console_result_additional_e) { f_array_length_t i = 0; f_array_length_t j = 0; diff --git a/level_3/utf8/c/private-print.c b/level_3/utf8/c/private-print.c index 395116d..32346cd 100644 --- a/level_3/utf8/c/private-print.c +++ b/level_3/utf8/c/private-print.c @@ -275,8 +275,6 @@ extern "C" { if (data->main->parameters.array[utf8_parameter_strip_invalid_e].result == f_console_result_found_e) return; if (data->main->parameters.array[utf8_parameter_verify_e].result == f_console_result_found_e) return; - f_status_t status = F_none; - if (data->mode & utf8_mode_to_combining_d) { utf8_print_error_combining_or_width(data); } -- 1.8.3.1