From: Kevin Day Date: Wed, 28 Apr 2021 04:20:08 +0000 (-0500) Subject: Cleanup: Use simpler logic for used > 0 check. X-Git-Tag: 0.5.3~7 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=3c39f9f83f30a188a7564ae97afd383db40bfe13;p=fll Cleanup: Use simpler logic for used > 0 check. The logic fo checking if used > 0 can be made simpler by simply checking used. (Given that used is always unsigned.) --- diff --git a/level_3/fake/c/private-build.c b/level_3/fake/c/private-build.c index 3795fe5..8985f20 100644 --- a/level_3/fake/c/private-build.c +++ b/level_3/fake/c/private-build.c @@ -49,7 +49,7 @@ extern "C" { if (F_status_is_error(*status)) break; } // for - if (data.path_work.used > 0) { + if (data.path_work.used) { f_array_length_t length = 0; if (F_status_is_error_not(*status)) { @@ -393,7 +393,7 @@ extern "C" { char directory_headers[directory_headers_length + 1]; - if (data_build.setting.path_headers.used > 0) { + if (data_build.setting.path_headers.used) { memcpy(directory_headers, data.path_build_includes.string, data.path_build_includes.used); memcpy(directory_headers + data.path_build_includes.used, data_build.setting.path_headers.string, data_build.setting.path_headers.used); @@ -1560,7 +1560,7 @@ extern "C" { f_array_length_t j = 0; // if any mode is specified, the entire defaults is replaced. - if (data.mode.used > 0) { + if (data.mode.used) { modes = &data.mode; } @@ -2044,7 +2044,7 @@ extern "C" { }; for (uint8_t i = 0; i < 3; i++) { - if (destinations[i]->used > 0) continue; + if (destinations[i]->used) continue; *status = f_string_append_assure(sources[i], lengths[i], destinations[i]); @@ -2587,7 +2587,7 @@ extern "C" { char directory_headers[directory_headers_length + 1]; - if (data_build.setting.path_headers.used > 0) { + if (data_build.setting.path_headers.used) { memcpy(directory_headers, data->path_build_includes.string, data->path_build_includes.used); memcpy(directory_headers + data->path_build_includes.used, data_build.setting.path_headers.string, data_build.setting.path_headers.used); @@ -2724,7 +2724,7 @@ extern "C" { } // if project-specific library sources exist, then the -lproject_name needs to be added to the arguments. - if (F_status_is_error_not(*status) && data_build.setting.build_sources_library.used > 0) { + if (F_status_is_error_not(*status) && data_build.setting.build_sources_library.used) { f_array_length_t link_project_library_length = fake_build_parameter_library_link_file_length + data_build.setting.project_name.used; char link_project_library[link_project_library_length + 1]; diff --git a/level_3/fake/c/private-fake.c b/level_3/fake/c/private-fake.c index 3c32a70..da0180f 100644 --- a/level_3/fake/c/private-fake.c +++ b/level_3/fake/c/private-fake.c @@ -388,7 +388,7 @@ extern "C" { } // for } - if (data->path_work.used > 0) { + if (data->path_work.used) { { f_string_dynamic_t * const parameters_value[] = { &data->path_work_includes, @@ -1001,7 +1001,7 @@ extern "C" { return F_status_set_error(F_signal); } - if (parameters_value[i]->used > 0) { + if (parameters_value[i]->used) { memset(&directory_stat, 0, sizeof(struct stat)); status = f_file_stat(parameters_value[i]->string, F_true, &directory_stat); diff --git a/level_3/fake/c/private-make.c b/level_3/fake/c/private-make.c index 2a2695b..dd74e8c 100644 --- a/level_3/fake/c/private-make.c +++ b/level_3/fake/c/private-make.c @@ -4521,7 +4521,7 @@ extern "C" { return; } - if (arguments.used > 0) { + if (arguments.used) { const f_string_t if_type_strings[] = { fake_make_operation_argument_if_defined, fake_make_operation_argument_if_equal,