From 18d7d5fa496a108d438b58400818ae6bdf3c1995 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Tue, 6 Apr 2021 23:58:47 -0500 Subject: [PATCH] Cleanup: printing and stale code. Structural problems related to printing. Relocate how the final newline being printed on simulate is structured in the code. Remove stale "simulate" variable that is no longer used. --- level_3/controller/c/controller.c | 4 ++-- level_3/controller/c/private-controller.c | 10 +--------- level_3/controller/c/private-rule.c | 1 - level_3/controller/c/private-thread.c | 2 -- 4 files changed, 3 insertions(+), 14 deletions(-) diff --git a/level_3/controller/c/controller.c b/level_3/controller/c/controller.c index 3125899..77abe1b 100644 --- a/level_3/controller/c/controller.c +++ b/level_3/controller/c/controller.c @@ -320,8 +320,8 @@ extern "C" { } // ensure a newline is always put at the end of the program execution, unless in quiet mode. - if (!(status == F_child || status == F_signal) && data->error.verbosity != f_console_verbosity_quiet) { - if (F_status_is_error(status)) { + if (!(status == F_child || status == F_signal)) { + if (F_status_is_error(status) && data->error.verbosity != f_console_verbosity_quiet) { fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); } } diff --git a/level_3/controller/c/private-controller.c b/level_3/controller/c/private-controller.c index c4edbfe..726046a 100644 --- a/level_3/controller/c/private-controller.c +++ b/level_3/controller/c/private-controller.c @@ -1241,20 +1241,12 @@ extern "C" { fprintf(main.data->output.stream, "%c", f_string_eol_s[0]); fprintf(main.data->output.stream, "Done processing entry item '"); fprintf(main.data->output.stream, "%s%s%s", main.data->context.set.title.before->string, controller_string_main_s, main.data->context.set.title.after->string); - fprintf(main.data->output.stream, "'.%c", f_string_eol_s[0]); + fprintf(main.data->output.stream, "'.%c%c", f_string_eol_s[0], f_string_eol_s[0]); f_thread_mutex_unlock(&main.thread->lock.print); } } - if (F_status_is_error_not(status) && simulate) { - f_thread_mutex_lock(&main.thread->lock.print); - - fprintf(main.data->output.stream, "%c", f_string_eol_s[0]); - - f_thread_mutex_unlock(&main.thread->lock.print); - } - return status; } #endif // _di_controller_process_entry_ diff --git a/level_3/controller/c/private-rule.c b/level_3/controller/c/private-rule.c index 2dac31c..80c7323 100644 --- a/level_3/controller/c/private-rule.c +++ b/level_3/controller/c/private-rule.c @@ -2121,7 +2121,6 @@ extern "C" { f_array_length_t id_rule = 0; const f_array_length_t used_original_stack = process->stack.used; - const bool simulate = main.data->parameters[controller_parameter_test].result == f_console_result_found; f_thread_lock_read(&main.thread->lock.rule); diff --git a/level_3/controller/c/private-thread.c b/level_3/controller/c/private-thread.c index 84cb2c1..8699528 100644 --- a/level_3/controller/c/private-thread.c +++ b/level_3/controller/c/private-thread.c @@ -249,7 +249,6 @@ extern "C" { if (f_file_exists(setting->path_pid.string) == F_true) { if (data->error.verbosity != f_console_verbosity_quiet) { - f_thread_mutex_lock(&thread.lock.print); fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); @@ -501,7 +500,6 @@ extern "C" { if (f_file_exists(entry->setting->path_pid.string) == F_true) { if (data->error.verbosity != f_console_verbosity_quiet) { - f_thread_mutex_lock(&entry->main->thread->lock.print); fprintf(data->error.to.stream, "%c", f_string_eol_s[0]); -- 1.8.3.1