From d35d7ec088882742e4c449f85a26535a6c938eb5 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Fri, 17 Mar 2023 18:23:17 -0500 Subject: [PATCH] Update: Don't call f_file_exists() until after child status is checked. If the process is exiting as a child process, don't perform the file exists check. This removes an unnecessary task that has disk I/O implications. --- level_3/fake/c/private-build-library.c | 9 ++++++--- level_3/fake/c/private-build-object.c | 9 ++++++--- level_3/fake/c/private-build-objects.c | 3 ++- level_3/fake/c/private-build-program.c | 9 ++++++--- level_3/fake/c/private-build-skeleton.c | 3 ++- level_3/fake/c/private-build.c | 3 ++- 6 files changed, 24 insertions(+), 12 deletions(-) diff --git a/level_3/fake/c/private-build-library.c b/level_3/fake/c/private-build-library.c index 67131ec..314f945 100644 --- a/level_3/fake/c/private-build-library.c +++ b/level_3/fake/c/private-build-library.c @@ -10,7 +10,8 @@ extern "C" { #ifndef _di_fake_build_library_script_ int fake_build_library_script(fake_data_t * const data, fake_build_data_t * const data_build, const f_mode_t mode, const f_string_static_t file_stage, f_status_t * const status) { - if (F_status_is_error(*status)|| *status == F_child || f_file_exists(file_stage, F_true) == F_true) return data->main->child; + if (*status == F_child) return data->main->child; + if (F_status_is_error(*status) || f_file_exists(file_stage, F_true) == F_true) return 0; fake_build_touch(data, file_stage, status); @@ -21,7 +22,8 @@ extern "C" { #ifndef _di_fake_build_library_shared_ int fake_build_library_shared(fake_data_t * const data, fake_build_data_t * const data_build, const f_mode_t mode, const f_string_static_t file_stage, f_status_t * const status) { - if (F_status_is_error(*status)|| *status == F_child || f_file_exists(file_stage, F_true) == F_true) return data->main->child; + if (*status == F_child) return data->main->child; + if (F_status_is_error(*status) || f_file_exists(file_stage, F_true) == F_true) return 0; if (!data_build->setting.build_sources_library.used && !data_build->setting.build_sources_library_shared.used) return 0; if (data->main->output.verbosity != f_console_verbosity_quiet_e && data->main->output.verbosity != f_console_verbosity_error_e) { @@ -443,7 +445,8 @@ extern "C" { #ifndef _di_fake_build_library_static_ int fake_build_library_static(fake_data_t * const data, fake_build_data_t * const data_build, const f_mode_t mode, const f_string_static_t file_stage, f_status_t * const status) { - if (F_status_is_error(*status)|| *status == F_child || f_file_exists(file_stage, F_true) == F_true) return data->main->child; + if (*status == F_child) return data->main->child; + if (F_status_is_error(*status) || f_file_exists(file_stage, F_true) == F_true) return 0; if (!data_build->setting.build_sources_library.used && !data_build->setting.build_sources_library_static.used) return 0; if (data->main->output.verbosity != f_console_verbosity_quiet_e && data->main->output.verbosity != f_console_verbosity_error_e) { diff --git a/level_3/fake/c/private-build-object.c b/level_3/fake/c/private-build-object.c index 78150f9..1ac55a0 100644 --- a/level_3/fake/c/private-build-object.c +++ b/level_3/fake/c/private-build-object.c @@ -11,7 +11,8 @@ extern "C" { #ifndef _di_fake_build_object_script_ int fake_build_object_script(fake_data_t * const data, fake_build_data_t * const data_build, const f_mode_t mode, const f_string_static_t file_stage, f_status_t * const status) { - if (F_status_is_error(*status)|| *status == F_child || f_file_exists(file_stage, F_true) == F_true) return data->main->child; + if (*status == F_child) return data->main->child; + if (F_status_is_error(*status) || f_file_exists(file_stage, F_true) == F_true) return 0; fake_build_touch(data, file_stage, status); @@ -22,7 +23,8 @@ extern "C" { #ifndef _di_fake_build_object_shared_ int fake_build_object_shared(fake_data_t * const data, fake_build_data_t * const data_build, const f_mode_t mode, const f_string_static_t file_stage, f_status_t * const status) { - if (F_status_is_error(*status)|| *status == F_child || f_file_exists(file_stage, F_true) == F_true) return data->main->child; + if (*status == F_child) return data->main->child; + if (F_status_is_error(*status) || f_file_exists(file_stage, F_true) == F_true) return 0; if (!data_build->setting.build_sources_object.used && !data_build->setting.build_sources_object_shared.used) return 0; if (data->main->output.verbosity != f_console_verbosity_quiet_e && data->main->output.verbosity != f_console_verbosity_error_e) { @@ -93,7 +95,8 @@ extern "C" { #ifndef _di_fake_build_object_static_ int fake_build_object_static(fake_data_t * const data, fake_build_data_t * const data_build, const f_mode_t mode, const f_string_static_t file_stage, f_status_t * const status) { - if (F_status_is_error(*status)|| *status == F_child || f_file_exists(file_stage, F_true) == F_true) return data->main->child; + if (*status == F_child) return data->main->child; + if (F_status_is_error(*status) || f_file_exists(file_stage, F_true) == F_true) return 0; if (!data_build->setting.build_sources_object.used && !data_build->setting.build_sources_object_static.used) return 0; if (data->main->output.verbosity != f_console_verbosity_quiet_e && data->main->output.verbosity != f_console_verbosity_error_e) { diff --git a/level_3/fake/c/private-build-objects.c b/level_3/fake/c/private-build-objects.c index 6494e78..db50092 100644 --- a/level_3/fake/c/private-build-objects.c +++ b/level_3/fake/c/private-build-objects.c @@ -11,7 +11,8 @@ extern "C" { #ifndef _di_fake_build_objects_static_ int fake_build_objects_static(fake_data_t * const data, fake_build_data_t * const data_build, const f_mode_t mode, const f_string_static_t file_stage, f_status_t * const status) { - if (F_status_is_error(*status)|| *status == F_child || f_file_exists(file_stage, F_true) == F_true) return data->main->child; + if (*status == F_child) return data->main->child; + if (F_status_is_error(*status) || f_file_exists(file_stage, F_true) == F_true) return 0; if (!data_build->setting.build_sources_library.used) return 0; if (data->main->output.verbosity != f_console_verbosity_quiet_e && data->main->output.verbosity != f_console_verbosity_error_e) { diff --git a/level_3/fake/c/private-build-program.c b/level_3/fake/c/private-build-program.c index e0e47e4..8181f56 100644 --- a/level_3/fake/c/private-build-program.c +++ b/level_3/fake/c/private-build-program.c @@ -11,7 +11,8 @@ extern "C" { #ifndef _di_fake_build_program_script_ int fake_build_program_script(fake_data_t * const data, fake_build_data_t * const data_build, const f_mode_t mode, const f_string_static_t file_stage, f_status_t * const status) { - if (F_status_is_error(*status)|| *status == F_child || f_file_exists(file_stage, F_true) == F_true) return data->main->child; + if (*status == F_child) return data->main->child; + if (F_status_is_error(*status) || f_file_exists(file_stage, F_true) == F_true) return 0; fake_build_touch(data, file_stage, status); @@ -22,7 +23,8 @@ extern "C" { #ifndef _di_fake_build_program_shared_ int fake_build_program_shared(fake_data_t * const data, fake_build_data_t * const data_build, const f_mode_t mode, const f_string_static_t file_stage, f_status_t * const status) { - if (F_status_is_error(*status)|| *status == F_child || f_file_exists(file_stage, F_true) == F_true) return data->main->child; + if (*status == F_child) return data->main->child; + if (F_status_is_error(*status) || f_file_exists(file_stage, F_true) == F_true) return 0; if (!data_build->setting.build_sources_program.used && !data_build->setting.build_sources_program_shared.used) return 0; if (data->main->output.verbosity != f_console_verbosity_quiet_e && data->main->output.verbosity != f_console_verbosity_error_e) { @@ -116,7 +118,8 @@ extern "C" { #ifndef _di_fake_build_program_static_ int fake_build_program_static(fake_data_t * const data, fake_build_data_t * const data_build, const f_mode_t mode, const f_string_static_t file_stage, f_status_t * const status) { - if (F_status_is_error(*status)|| *status == F_child || f_file_exists(file_stage, F_true) == F_true) return data->main->child; + if (*status == F_child) return data->main->child; + if (F_status_is_error(*status) || f_file_exists(file_stage, F_true) == F_true) return 0; if (!data_build->setting.build_sources_program.used && !data_build->setting.build_sources_program_static.used) return 0; if (data->main->output.verbosity != f_console_verbosity_quiet_e && data->main->output.verbosity != f_console_verbosity_error_e) { diff --git a/level_3/fake/c/private-build-skeleton.c b/level_3/fake/c/private-build-skeleton.c index 26e3a5a..524ba6a 100644 --- a/level_3/fake/c/private-build-skeleton.c +++ b/level_3/fake/c/private-build-skeleton.c @@ -11,7 +11,8 @@ extern "C" { #ifndef _di_fake_build_skeleton_ void fake_build_skeleton(fake_data_t * const data, fake_build_data_t * const data_build, const mode_t mode, const f_string_static_t file_stage, f_status_t * const status) { - if (F_status_is_error(*status)|| *status == F_child || f_file_exists(file_stage, F_true) == F_true) return; + if (*status == F_child) return; + if (F_status_is_error(*status) || f_file_exists(file_stage, F_true) == F_true); f_string_static_t path_headers = f_string_static_t_initialize; path_headers.used = data->path_build_includes.used + data_build->setting.path_headers.used; diff --git a/level_3/fake/c/private-build.c b/level_3/fake/c/private-build.c index b364a23..945edfc 100644 --- a/level_3/fake/c/private-build.c +++ b/level_3/fake/c/private-build.c @@ -555,7 +555,8 @@ const f_string_static_t fake_build_documentation_files_s = macro_f_string_static #ifndef _di_fake_build_execute_process_script_ int fake_build_execute_process_script(fake_data_t * const data, fake_build_data_t * const data_build, const f_string_static_t process_script, const f_string_static_t file_stage, f_status_t *status) { - if (F_status_is_error(*status)|| *status == F_child || f_file_exists(file_stage, F_true) == F_true) return data->main->child; + if (*status == F_child) return data->main->child; + if (F_status_is_error(*status) || f_file_exists(file_stage, F_true) == F_true) return 0; if (!process_script.used) return 0; f_string_dynamics_t arguments = f_string_dynamics_t_initialize; -- 1.8.3.1