From 4c82c057d7a11e8d2626dc35fd9bb0dc1565bc2d Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Sun, 26 Mar 2023 21:21:12 -0500 Subject: [PATCH] Update: Use the recently refactored f_compare, f_parse, f_rip. --- data/build/remove/dependencies | 2 ++ data/build/remove/settings | 2 +- sources/c/remove/main/common.c | 26 +++++++++++++------------- sources/c/remove/main/convert.c | 12 ++++++------ sources/c/remove/main/convert.h | 12 ++++++------ sources/c/remove/main/remove.h | 3 ++- 6 files changed, 30 insertions(+), 27 deletions(-) diff --git a/data/build/remove/dependencies b/data/build/remove/dependencies index ba35870..f6570ba 100644 --- a/data/build/remove/dependencies +++ b/data/build/remove/dependencies @@ -8,10 +8,12 @@ f_string f_utf f_account f_color +f_compare f_console f_conversion f_file f_print +f_rip f_signal f_thread diff --git a/data/build/remove/settings b/data/build/remove/settings index 53be599..74b94aa 100644 --- a/data/build/remove/settings +++ b/data/build/remove/settings @@ -21,7 +21,7 @@ build_indexer_arguments rcs build_language c build_libraries -lc -build_libraries-individual -lfll_error -lfll_print -lfll_program -lfl_conversion -lfl_print -lfl_string -lf_account -lf_color -lf_console -lf_conversion -lf_file -lf_memory -lf_pipe -lf_print -lf_signal -lf_string -lf_type_array -lf_utf +build_libraries-individual -lfll_error -lfll_print -lfll_program -lfl_conversion -lfl_print -lf_account -lf_color -lf_compare -lf_console -lf_conversion -lf_file -lf_memory -lf_pipe -lf_print -lf_rip -lf_signal -lf_string -lf_thread -lf_type_array -lf_utf build_libraries-level -lfll_2 -lfll_1 -lfll_0 build_libraries-monolithic -lfll diff --git a/sources/c/remove/main/common.c b/sources/c/remove/main/common.c index da41cc1..c7b3e11 100644 --- a/sources/c/remove/main/common.c +++ b/sources/c/remove/main/common.c @@ -372,7 +372,7 @@ extern "C" { for (j = 0; j < 12; ++j) { - if (fl_string_dynamic_compare(main->program.parameters.arguments.array[index], strings[j]) == F_equal_to) { + if (f_compare_dynamic(main->program.parameters.arguments.array[index], strings[j]) == F_equal_to) { dates[p]->array[dates[p]->used].operation = enumerations[j]; index2 = parameters[p]->values.array[i + 1]; @@ -425,7 +425,7 @@ extern "C" { index = main->program.parameters.array[kt_remove_parameter_empty_e].values.array[total_arguments - 1]; - if (fl_string_dynamic_compare(kt_remove_not_s, main->program.parameters.arguments.array[index]) == F_equal_to) { + if (f_compare_dynamic(kt_remove_not_s, main->program.parameters.arguments.array[index]) == F_equal_to) { main->setting.flag |= kt_remove_main_flag_empty_not_e; if (main->setting.flag & kt_remove_main_flag_empty_not_fail_e) { @@ -440,7 +440,7 @@ extern "C" { main->setting.flag -= kt_remove_main_flag_empty_only_fail_e; } } - else if (fl_string_dynamic_compare(kt_remove_not_fail_s, main->program.parameters.arguments.array[index]) == F_equal_to) { + else if (f_compare_dynamic(kt_remove_not_fail_s, main->program.parameters.arguments.array[index]) == F_equal_to) { main->setting.flag |= kt_remove_main_flag_empty_not_fail_e; if (main->setting.flag & kt_remove_main_flag_empty_not_e) { @@ -455,7 +455,7 @@ extern "C" { main->setting.flag -= kt_remove_main_flag_empty_only_fail_e; } } - else if (fl_string_dynamic_compare(kt_remove_only_s, main->program.parameters.arguments.array[index]) == F_equal_to) { + else if (f_compare_dynamic(kt_remove_only_s, main->program.parameters.arguments.array[index]) == F_equal_to) { main->setting.flag |= kt_remove_main_flag_empty_only_e; if (main->setting.flag & kt_remove_main_flag_empty_not_e) { @@ -470,7 +470,7 @@ extern "C" { main->setting.flag -= kt_remove_main_flag_empty_only_fail_e; } } - else if (fl_string_dynamic_compare(kt_remove_only_fail_s, main->program.parameters.arguments.array[index]) == F_equal_to) { + else if (f_compare_dynamic(kt_remove_only_fail_s, main->program.parameters.arguments.array[index]) == F_equal_to) { main->setting.flag |= kt_remove_main_flag_empty_only_fail_e; if (main->setting.flag & kt_remove_main_flag_empty_not_e) { @@ -566,7 +566,7 @@ extern "C" { // // index = main->program.parameters.array[kt_remove_parameter_isolate_e].values.array[total_arguments - 1]; // - // if (fl_string_dynamic_compare(kt_remove_all_s, main->program.parameters.arguments.array[index]) == F_equal_to) { + // if (f_compare_dynamic(kt_remove_all_s, main->program.parameters.arguments.array[index]) == F_equal_to) { // main->setting.flag |= kt_remove_main_flag_isolate_all_e; // // if (main->setting.flag & kt_remove_main_flag_isolate_ignore_e) { @@ -577,7 +577,7 @@ extern "C" { // main->setting.flag -= kt_remove_main_flag_isolate_root_e; // } // } - // else if (fl_string_dynamic_compare(kt_remove_ignore_s, main->program.parameters.arguments.array[index]) == F_equal_to) { + // else if (f_compare_dynamic(kt_remove_ignore_s, main->program.parameters.arguments.array[index]) == F_equal_to) { // main->setting.flag |= kt_remove_main_flag_isolate_ignore_e; // // if (main->setting.flag & kt_remove_main_flag_isolate_all_e) { @@ -588,7 +588,7 @@ extern "C" { // main->setting.flag -= kt_remove_main_flag_isolate_root_e; // } // } - // else if (fl_string_dynamic_compare(kt_remove_root_s, main->program.parameters.arguments.array[index]) == F_equal_to) { + // else if (f_compare_dynamic(kt_remove_root_s, main->program.parameters.arguments.array[index]) == F_equal_to) { // main->setting.flag |= kt_remove_main_flag_isolate_root_e; // // if (main->setting.flag & kt_remove_main_flag_isolate_all_e) { @@ -669,7 +669,7 @@ extern "C" { for (j = 0; j < 8; ++j) { - if (fl_string_dynamic_compare(main->program.parameters.arguments.array[index], strings[j]) == F_equal_to) { + if (f_compare_dynamic(main->program.parameters.arguments.array[index], strings[j]) == F_equal_to) { main->setting.modes.array[main->setting.modes.used].type = enumerations[j]; index2 = main->program.parameters.array[kt_remove_parameter_mode_e].values.array[i + 1]; @@ -765,7 +765,7 @@ extern "C" { index = main->program.parameters.array[kt_remove_parameter_prompt_e].values.array[total_arguments - 1]; - if (fl_string_dynamic_compare(kt_remove_all_s, main->program.parameters.arguments.array[index]) == F_equal_to) { + if (f_compare_dynamic(kt_remove_all_s, main->program.parameters.arguments.array[index]) == F_equal_to) { main->setting.flag |= kt_remove_main_flag_prompt_all_e; if (main->setting.flag & kt_remove_main_flag_prompt_follow_e) { @@ -780,7 +780,7 @@ extern "C" { main->setting.flag -= kt_remove_main_flag_prompt_never_e; } } - else if (fl_string_dynamic_compare(kt_remove_follow_s, main->program.parameters.arguments.array[index]) == F_equal_to) { + else if (f_compare_dynamic(kt_remove_follow_s, main->program.parameters.arguments.array[index]) == F_equal_to) { main->setting.flag |= kt_remove_main_flag_prompt_follow_e; if (main->setting.flag & kt_remove_main_flag_prompt_all_e) { @@ -795,7 +795,7 @@ extern "C" { main->setting.flag -= kt_remove_main_flag_prompt_never_e; } } - else if (fl_string_dynamic_compare(kt_remove_once_s, main->program.parameters.arguments.array[index]) == F_equal_to) { + else if (f_compare_dynamic(kt_remove_once_s, main->program.parameters.arguments.array[index]) == F_equal_to) { main->setting.flag |= kt_remove_main_flag_prompt_once_e; if (main->setting.flag & kt_remove_main_flag_prompt_all_e) { @@ -810,7 +810,7 @@ extern "C" { main->setting.flag -= kt_remove_main_flag_prompt_never_e; } } - else if (fl_string_dynamic_compare(kt_remove_never_s, main->program.parameters.arguments.array[index]) == F_equal_to) { + else if (f_compare_dynamic(kt_remove_never_s, main->program.parameters.arguments.array[index]) == F_equal_to) { main->setting.flag |= kt_remove_main_flag_prompt_never_e; if (main->setting.flag & kt_remove_main_flag_prompt_all_e) { diff --git a/sources/c/remove/main/convert.c b/sources/c/remove/main/convert.c index 9dd12c7..6613eb8 100644 --- a/sources/c/remove/main/convert.c +++ b/sources/c/remove/main/convert.c @@ -30,7 +30,7 @@ extern "C" { for (uint8_t i = 0; i < 4; ++i) { - if (fl_string_dynamic_compare(buffer, strings[i]) == F_equal_to) { + if (f_compare_dynamic(buffer, strings[i]) == F_equal_to) { date->type = enumerations[i]; kt_remove_convert_date_relative(main, date); @@ -90,7 +90,7 @@ extern "C" { if (matches & kt_remove_flag_convert_colon_e) { // Search until a colon or a digit is found. - if (fl_string_dynamic_compare_string(buffer.string + range.start, f_string_ascii_colon_s, width) == F_equal_to) { + if (f_compare_dynamic_string(buffer.string + range.start, f_string_ascii_colon_s, width) == F_equal_to) { // A third colon is not valid. if (matches & kt_remove_flag_convert_colon_double_e) { @@ -123,7 +123,7 @@ extern "C" { if (matches & kt_remove_flag_convert_match_first_e) { - if (fl_string_dynamic_compare_string(buffer.string + range.start, f_string_ascii_colon_s, width) == F_equal_to) { + if (f_compare_dynamic_string(buffer.string + range.start, f_string_ascii_colon_s, width) == F_equal_to) { matches |= kt_remove_flag_convert_colon_single_e; continue; @@ -159,7 +159,7 @@ extern "C" { if (main->setting.state.status == F_true) continue; - if (fl_string_dynamic_compare_string(buffer.string + range.start, f_string_ascii_colon_s, width) == F_equal_to) { + if (f_compare_dynamic_string(buffer.string + range.start, f_string_ascii_colon_s, width) == F_equal_to) { matches |= kt_remove_flag_convert_colon_single_e; continue; @@ -461,7 +461,7 @@ extern "C" { if (F_status_set_fine(main->setting.state.status) == F_number) { main->setting.buffer.used = 0; - main->setting.state.status = fl_string_dynamic_rip_nulless(buffer, &main->setting.buffer); + main->setting.state.status = f_rip_dynamic_nulless(buffer, &main->setting.buffer); if (F_status_is_error(main->setting.state.status)) return 0; gid_t gid = 0; @@ -508,7 +508,7 @@ extern "C" { if (F_status_set_fine(main->setting.state.status) == F_number) { main->setting.buffer.used = 0; - main->setting.state.status = fl_string_dynamic_rip_nulless(buffer, &main->setting.buffer); + main->setting.state.status = f_rip_dynamic_nulless(buffer, &main->setting.buffer); if (F_status_is_error(main->setting.state.status)) return 0; uid_t uid = 0; diff --git a/sources/c/remove/main/convert.h b/sources/c/remove/main/convert.h index 62b1eb8..d76d8fd 100644 --- a/sources/c/remove/main/convert.h +++ b/sources/c/remove/main/convert.h @@ -46,8 +46,8 @@ extern "C" { * F_number_too_small (with error bit) if the given ID is too small. * F_known_not (with error bit) if the given string is not of a known format * + * Errors (with error bit) from: f_rip_dynamic_nulless(). * Errors (with error bit) from: fl_conversion_dynamic_partial_to_unsigned_detect(). - * Errors (with error bit) from: fl_string_dynamic_partial_rip_nulless(). * * Errors (with error bit) from: kt_remove_get_date_relative(). * @param buffer @@ -55,8 +55,8 @@ extern "C" { * @param date * The converted date. * + * @see f_rip_dynamic_nulless() * @see fl_conversion_dynamic_partial_to_unsigned_detect() - * @see fl_string_dynamic_partial_rip_nulless() * * @see kt_remove_get_date_relative() */ @@ -116,14 +116,14 @@ extern "C" { * F_number_too_large (with error bit) if the given ID is too large. * * Errors (with error bit) from: f_account_group_id_by_name(). + * Errors (with error bit) from: f_rip_dynamic_nulless(). * Errors (with error bit) from: fl_conversion_dynamic_to_unsigned_detect(). - * Errors (with error bit) from: fl_string_dynamic_rip_nulless(). * @param buffer * A string containing group name or ID. * * @see f_account_group_id_by_name() + * @see f_rip_dynamic_nulless() * @see fl_conversion_dynamic_to_unsigned_detect() - * @see fl_string_dynamic_rip_nulless() */ #ifndef _di_kt_remove_get_id_group_ extern uint32_t kt_remove_get_id_group(kt_remove_main_t * const main, const f_string_static_t buffer); @@ -141,14 +141,14 @@ extern "C" { * F_number_too_large (with error bit) if the given ID is too large. * * Errors (with error bit) from: f_account_group_id_by_name(). + * Errors (with error bit) from: f_rip_dynamic_nulless(). * Errors (with error bit) from: fl_conversion_dynamic_to_unsigned_detect(). - * Errors (with error bit) from: fl_string_dynamic_rip_nulless(). * @param buffer * A string containing group name or ID. * * @see f_account_id_by_name() + * @see f_rip_dynamic_nulless() * @see fl_conversion_dynamic_to_unsigned_detect() - * @see fl_string_dynamic_rip_nulless() */ #ifndef _di_kt_remove_get_id_user_ extern uint32_t kt_remove_get_id_user(kt_remove_main_t * const main, const f_string_static_t buffer); diff --git a/sources/c/remove/main/remove.h b/sources/c/remove/main/remove.h index 4f36d4c..125d828 100644 --- a/sources/c/remove/main/remove.h +++ b/sources/c/remove/main/remove.h @@ -25,19 +25,20 @@ #include #include #include +#include #include #include #include #include #include #include +#include #include #include // FLL-1 includes. #include #include -#include // FLL-2 includes. #include -- 1.8.3.1