From: Kevin Day Date: Thu, 29 Aug 2019 20:40:03 +0000 (-0500) Subject: Cleanup: remove error test macros X-Git-Tag: 0.5.0~470 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=16ab3ed63ad6d2a8fce05666858cbd416365e7ec;p=fll Cleanup: remove error test macros This is legacy behavior that is no longer needed. Update any existing uses of these deleted macros. --- diff --git a/level_0/f_errors/c/errors.h b/level_0/f_errors/c/errors.h index bf45561..e452418 100644 --- a/level_0/f_errors/c/errors.h +++ b/level_0/f_errors/c/errors.h @@ -19,126 +19,6 @@ extern "C" { #endif -#ifndef _di_f_macro_test_for_basic_errors_ - #define f_macro_test_for_basic_errors(potential_error) \ - ( potential_error == f_critical || \ - potential_error == f_unknown || \ - potential_error == f_unsupported || \ - potential_error == f_invalid_parameter || \ - potential_error == f_invalid_syntax || \ - potential_error == f_invalid_data || \ - potential_error == f_output_error || \ - potential_error == f_does_not_exist || \ - potential_error == f_failure) -#endif // _di_f_macro_test_for_basic_errors_ - -#ifndef _di_f_macro_test_for_allocation_errors_ - // FIXME: invalid_parameter was temporarily added here so that parameter checking could be corrected for all allocations and deallocations - #define f_macro_test_for_allocation_errors(potential_error) \ - ( potential_error == f_allocation_error || \ - potential_error == f_reallocation_error || \ - potential_error == f_file_allocation_error || \ - potential_error == f_file_reallocation_error || \ - potential_error == f_directory_allocation_error || \ - potential_error == f_invalid_parameter || \ - potential_error == f_directory_reallocation_error ) -#endif // _di_f_macro_test_for_allocation_errors_ - -#ifndef _di_f_macro_test_for_non_errors_ - #define f_macro_test_for_non_errors(potential_error) \ - ( potential_error == f_true || \ - potential_error == f_false || \ - potential_error == f_warn || \ - potential_error == f_no_data || \ - potential_error == f_no_data_on_eos || \ - potential_error == f_no_data_on_eof || \ - potential_error == f_no_data_on_stop || \ - potential_error == f_none_on_eof || \ - potential_error == f_none_on_eos || \ - potential_error == f_none_on_stop || \ - potential_error == f_less_than || \ - potential_error == f_equal_to || \ - potential_error == f_not_equal_to || \ - potential_error == f_greater_than || \ - potential_error == f_none ) -#endif // _di_f_macro_test_for_non_errors_ - -#ifndef _di_macro_f_test_for_file_errors_ - #define f_macro_test_for_file_errors(potential_error) \ - ( potential_error == f_file_seek_error || \ - potential_error == f_file_read_error || \ - potential_error == f_file_write_error || \ - potential_error == f_file_flush_error || \ - potential_error == f_file_purge_error || \ - potential_error == f_file_open_error || \ - potential_error == f_file_close_error || \ - potential_error == f_file_synchronize_error || \ - potential_error == f_file_descriptor_error || \ - potential_error == f_file_not_found || \ - potential_error == f_file_is_empty || \ - potential_error == f_file_not_open ) -#endif // _di_f_macro_test_for_file_errors_ - -#ifndef _di_f_macro_test_for_directory_errors_ - #define f_macro_test_for_directory_errors(parameter) \ - ( potential_error == f_directory_seek_error || \ - potential_error == f_directory_read_error || \ - potential_error == f_directory_write_error || \ - potential_error == f_directory_flush_error || \ - potential_error == f_directory_purge_error || \ - potential_error == f_directory_open_error || \ - potential_error == f_directory_close_error || \ - potential_error == f_directory_synchronize_error || \ - potential_error == f_directory_descriptor_error || \ - potential_error == f_directory_not_found || \ - potential_error == f_directory_is_empty || \ - potential_error == f_directory_not_open ) -#endif // _di_f_macro_test_for_directory_errors_ - -#ifndef _di_f_macro_test_for_none_errors_ - #define f_macro_test_for_none_errors(potential_error) \ - ( potential_error == f_none || \ - potential_error == f_none_on_eof || \ - potential_error == f_none_on_eol || \ - potential_error == f_none_on_eos || \ - potential_error == f_none_on_stop) -#endif // _di_f_macro_test_for_none_errors_ - -#ifndef _di_f_macro_test_for_no_data_errors_ - #define f_macro_test_for_no_data_errors(potential_error) \ - ( potential_error == f_no_data || \ - potential_error == f_no_data_on_eof || \ - potential_error == f_no_data_on_eol || \ - potential_error == f_no_data_on_eos || \ - potential_error == f_no_data_on_stop) -#endif // _di_f_macro_test_for_no_data_errors_ - -#ifndef _di_f_macro_test_for_on_errors_ - #define f_macro_test_for_on_errors(potential_error) \ - ( potential_error == f_error_on_eof || \ - potential_error == f_error_on_eol || \ - potential_error == f_error_on_eos || \ - potential_error == f_error_on_stop) -#endif // _di_f_macro_test_for_on_errors_ - -#ifndef _di_f_macro_test_for_unterminated_nest_errors_ - #define f_macro_test_for_unterminated_nest_errors(potential_error) \ - ( potential_error == f_unterminated_nest || \ - potential_error == f_unterminated_nest_on_eof || \ - potential_error == f_unterminated_nest_on_eol || \ - potential_error == f_unterminated_nest_on_eos || \ - potential_error == f_unterminated_nest_on_stop) -#endif // _di_f_macro_test_for_unterminated_nest_errors_ - -#ifndef _di_f_macro_test_for_unterminated_group_errors_ - #define f_macro_test_for_unterminated_group_errors(potential_error) \ - ( potential_error == f_unterminated_group || \ - potential_error == f_unterminated_group_on_eof || \ - potential_error == f_unterminated_group_on_eol || \ - potential_error == f_unterminated_group_on_eos || \ - potential_error == f_unterminated_group_on_stop) -#endif // _di_f_macro_test_for_unterminated_group_errors_ - #ifndef _di_f_error_masks_ // f_status is required to be exactly 16 bits, the first two high order bits represent error and warning respectively. #define f_error_bit_error 0x8000 // 1000 0000 0000 0000 diff --git a/level_1/fl_colors/c/colors.c b/level_1/fl_colors/c/colors.c index 736e7be..e86a93d 100644 --- a/level_1/fl_colors/c/colors.c +++ b/level_1/fl_colors/c/colors.c @@ -52,7 +52,7 @@ extern "C" { f_resize_dynamic_string(status, (*buffer), buffer->used + string_size + 1); // the additional 1 is the EOS - if (f_macro_test_for_allocation_errors(status)) { + if (f_error_is_error(status)) { return status; } } diff --git a/level_1/fl_fss/c/fss_errors.h b/level_1/fl_fss/c/fss_errors.h index 1a13404..03187e1 100644 --- a/level_1/fl_fss/c/fss_errors.h +++ b/level_1/fl_fss/c/fss_errors.h @@ -19,15 +19,6 @@ extern "C" { #endif -#ifndef _di_fl_macro_test_for_fss_errors_ - #define fl_macro_test_for_fss_errors(potential_error) \ - ( !f_macro_test_for_non_errors(potential_error) && \ - potential_error != fl_fss_no_header && \ - potential_error != fl_fss_no_header_eos && \ - potential_error != fl_fss_accepted_but_invalid && \ - potential_error != fl_fss_accepted_but_invalid_eos ) -#endif // _di_fl_macro_test_for_fss_errors_ - enum { fl_fss_error_start = f_last_error_code, diff --git a/level_2/fll_fss/c/fss_basic.c b/level_2/fll_fss/c/fss_basic.c index 095d311..65123e8 100644 --- a/level_2/fll_fss/c/fss_basic.c +++ b/level_2/fll_fss/c/fss_basic.c @@ -149,17 +149,17 @@ extern "C" { status = fl_fss_basic_object_write(buffer, object, &location); - if (f_macro_test_for_no_data_errors(status)) { + if (f_error_is_error(status) || status == f_no_data_on_stop || status == f_no_data_on_eos) { return status; } - if (f_macro_test_for_none_errors(status)) { + if (status == f_none || status == f_none_on_stop || status == f_none_on_eos || status == f_none_on_eol) { if (contents.used > 0) { location.start = 0; location.stop = contents.array[0].used - 1; status = fl_fss_basic_content_write(buffer, contents.array[0], &location); - if (f_macro_test_for_no_data_errors(status)) { + if (f_error_is_error(status)) { return status; } } diff --git a/level_2/fll_fss/c/fss_basic_list.c b/level_2/fll_fss/c/fss_basic_list.c index bda34b5..8d5c3bd 100644 --- a/level_2/fll_fss/c/fss_basic_list.c +++ b/level_2/fll_fss/c/fss_basic_list.c @@ -149,17 +149,17 @@ extern "C" { status = fl_fss_basic_list_object_write(object, &location, buffer); - if (f_macro_test_for_no_data_errors(status)) { + if (f_error_is_error(status) || status == f_no_data_on_stop || status == f_no_data_on_eos) { return status; } - if (f_macro_test_for_none_errors(status)) { + if (status == f_none || status == f_none_on_stop || status == f_none_on_eos || status == f_none_on_eol) { if (contents.used > 0) { location.start = 0; location.stop = contents.array[0].used - 1; status = fl_fss_basic_list_content_write(contents.array[0], &location, buffer); - if (f_macro_test_for_no_data_errors(status)) { + if (f_error_is_error(status) || status == f_no_data_on_stop || status == f_no_data_on_eos) { return status; } } diff --git a/level_2/fll_fss/c/fss_extended.c b/level_2/fll_fss/c/fss_extended.c index 42092f7..d8e3b6b 100644 --- a/level_2/fll_fss/c/fss_extended.c +++ b/level_2/fll_fss/c/fss_extended.c @@ -148,17 +148,17 @@ extern "C" { status = fl_fss_extended_object_write(object, &location, buffer); - if (f_macro_test_for_no_data_errors(status)) { + if (f_error_is_error(status) || status == f_no_data_on_stop || status == f_no_data_on_eos) { return status; } - if (f_macro_test_for_none_errors(status)) { + if (status == f_none || status == f_none_on_stop || status == f_none_on_eos || status == f_none_on_eol) { while (current < contents.used) { location.start = 0; location.stop = contents.array[current].used - 1; status = fl_fss_extended_content_write(contents.array[current], &location, buffer); - if (f_macro_test_for_no_data_errors(status)) { + if (f_error_is_error(status) || status == f_no_data_on_stop || status == f_no_data_on_eos) { return status; } diff --git a/level_3/firewall/c/firewall.c b/level_3/firewall/c/firewall.c index 16a7658..2d9cf98 100644 --- a/level_3/firewall/c/firewall.c +++ b/level_3/firewall/c/firewall.c @@ -136,7 +136,7 @@ extern "C" { // to do this, one must look for any "has_additional" and then see if the "additional" location is set to 0 // nothing can be 0 as that represents the program name, unless argv[] is improperly created } - else if (f_macro_test_for_allocation_errors(status)) { + else if (status == f_allocation_error || status == f_reallocation_error) { fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "CRITICAL ERROR: unable to allocate memory"); } else if (f_error_set_fine(status) == f_invalid_parameter) { @@ -348,7 +348,7 @@ extern "C" { if (f_error_is_error(status)) { status = f_error_set_fine(status); - if (f_macro_test_for_allocation_errors(status)) { + if (status == f_allocation_error || status == f_reallocation_error) { fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "CRITICAL ERROR: unable to allocate memory"); } else { @@ -398,7 +398,7 @@ extern "C" { if (f_error_is_error(status)) { status = f_error_set_fine(status); - if (f_macro_test_for_allocation_errors(status)) { + if (status == f_allocation_error || status == f_reallocation_error) { fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "CRITICAL ERROR: unable to allocate memory"); } else if (status == f_no_data) { diff --git a/level_3/firewall/c/private-firewall.c b/level_3/firewall/c/private-firewall.c index 34aaf01..cd60e6c 100644 --- a/level_3/firewall/c/private-firewall.c +++ b/level_3/firewall/c/private-firewall.c @@ -596,7 +596,7 @@ f_return_status firewall_perform_commands(const firewall_local_data local, const else if (status == f_file_descriptor_error) { fl_print_color_line(f_standard_error, data.context.error, data.context.reset, "ERROR: File descriptor error while trying to open the file '%.*s'", file_path.used, file_path.string); } - else if (f_macro_test_for_allocation_errors(status)) { + else if (status == f_allocation_error || status == f_reallocation_error) { fl_print_color_line(f_standard_error, data.context.error, data.context.reset, "CRITICAL ERROR: unable to allocate memory"); } else { @@ -638,7 +638,7 @@ f_return_status firewall_perform_commands(const firewall_local_data local, const else if (status == f_file_read_error) { fl_print_color_line(f_standard_error, data.context.error, data.context.reset, "ERROR: A read error occurred while accessing the file '%.*s'", file_path.used, file_path.string); } - else if (f_macro_test_for_allocation_errors(status)) { + else if (status == f_allocation_error || status == f_reallocation_error) { fl_print_color_line(f_standard_error, data.context.error, data.context.reset, "CRITICAL ERROR: unable to allocate memory"); } else { @@ -665,7 +665,7 @@ f_return_status firewall_perform_commands(const firewall_local_data local, const else if (status == f_no_data_on_eos || status == f_no_data || status == f_no_data_on_stop) { // empty files are to be silently ignored } - else if (f_macro_test_for_allocation_errors(status)) { + else if (status == f_allocation_error || status == f_reallocation_error) { fl_print_color_line(f_standard_error, data.context.error, data.context.reset, "CRITICAL ERROR: unable to allocate memory"); } else { @@ -1397,7 +1397,7 @@ f_return_status firewall_buffer_rules(const f_string filename, const f_bool opti else if (status == f_file_read_error) { fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: A read error occurred while accessing the file '%s'.", filename); } - else if (f_macro_test_for_allocation_errors(status)) { + else if (status == f_allocation_error || status == f_reallocation_error) { fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "CRITICAL ERROR: unable to allocate memory."); } else { @@ -1423,7 +1423,7 @@ f_return_status firewall_buffer_rules(const f_string filename, const f_bool opti else if (status == f_no_data_on_eos || status == f_no_data || status == f_no_data_on_stop) { fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: No relevant data was found within the file '%s'.", filename); } - else if (f_macro_test_for_allocation_errors(status)) { + else if (status == f_allocation_error || status == f_reallocation_error) { fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "CRITICAL ERROR: unable to allocate memory."); } else { @@ -1448,7 +1448,7 @@ f_return_status firewall_process_rules(f_string_location *input, firewall_local_ if (f_error_is_error(status)) { status = f_error_set_fine(status); - if (f_macro_test_for_allocation_errors(status)) { + if (status == f_allocation_error || status == f_reallocation_error) { fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "CRITICAL ERROR: unable to allocate memory."); } else if (status == f_failure) { diff --git a/level_3/fss_basic_list_read/c/fss_basic_list_read.c b/level_3/fss_basic_list_read/c/fss_basic_list_read.c index 141694f..f9885fe 100644 --- a/level_3/fss_basic_list_read/c/fss_basic_list_read.c +++ b/level_3/fss_basic_list_read/c/fss_basic_list_read.c @@ -145,7 +145,7 @@ extern "C" { // to do this, one must look for any "has_additional" and then see if the "additional" location is set to 0 // nothing can be 0 as that represents the program name, unless argv[] is improperly created } - else if (f_macro_test_for_allocation_errors(status)) { + else if (status == f_allocation_error || status == f_reallocation_error) { fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "CRITICAL ERROR: unable to allocate memory"); } else if (status == f_invalid_parameter) { @@ -283,7 +283,7 @@ extern "C" { else if (status == f_file_read_error) { fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: A read error occurred while accessing the file '%s'", argv[data->remaining.array[counter]]); } - else if (f_macro_test_for_allocation_errors(status)) { + else if (status == f_allocation_error || status == f_reallocation_error) { fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "CRITICAL ERROR: unable to allocate memory"); } else { @@ -336,7 +336,7 @@ extern "C" { if (status == f_invalid_parameter) { fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: Invalid parameter when calling fll_fss_basic_list_read() for the file '%s'", filename); } - else if (f_macro_test_for_allocation_errors(status)) { + else if (status == f_allocation_error || status == f_reallocation_error) { fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "CRITICAL ERROR: unable to allocate memory"); } else if (status == f_incomplete_utf_on_stop) { @@ -352,7 +352,7 @@ extern "C" { fss_basic_list_read_delete_data(data); return f_error_set_error(status); } - else if (f_macro_test_for_no_data_errors(status)) { + else if (status == f_no_data_on_stop || status == f_no_data_on_eos) { // clear buffers, then attempt the next file f_delete_fss_contents(status2, data->contents); f_delete_fss_objects(status2, data->objects); diff --git a/level_3/fss_basic_list_write/c/fss_basic_list_write.c b/level_3/fss_basic_list_write/c/fss_basic_list_write.c index 2a53f1b..e67a81b 100644 --- a/level_3/fss_basic_list_write/c/fss_basic_list_write.c +++ b/level_3/fss_basic_list_write/c/fss_basic_list_write.c @@ -117,7 +117,7 @@ extern "C" { // to do this, one must look for any "has_additional" and then see if the "additional" location is set to 0 // nothing can be 0 as that represents the program name, unless argv[] is improperly created } - else if (f_macro_test_for_allocation_errors(status)) { + else if (status == f_allocation_error || status == f_reallocation_error) { fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "CRITICAL ERROR: unable to allocate memory."); } else if (status == f_invalid_parameter) { @@ -183,14 +183,14 @@ extern "C" { if (object) { status = fl_fss_basic_list_object_write(input, &location, &buffer); - if (f_error_is_error(status) || f_macro_test_for_no_data_errors(status)) { + if (f_error_is_error(status) || status == f_no_data_on_stop || status == f_no_data_on_eos || status == f_no_data_on_eol) { return f_error_set_error(status); } } else { status = fl_fss_basic_list_content_write(input, &location, &buffer); - if (f_error_is_error(status) || f_macro_test_for_no_data_errors(status)) { + if (f_error_is_error(status) || status == f_no_data_on_stop || status == f_no_data_on_eos || status == f_no_data_on_eol) { return f_error_set_error(status); } } @@ -209,14 +209,14 @@ extern "C" { if (object) { status = fl_fss_basic_list_object_write(input, &location, &buffer); - if (f_error_is_error(status) || f_macro_test_for_no_data_errors(status)) { + if (f_error_is_error(status) || status == f_no_data_on_stop || status == f_no_data_on_eos || status == f_no_data_on_eol) { return f_error_set_error(status); } } else { status = fl_fss_basic_list_content_write(input, &location, &buffer); - if (f_error_is_error(status) || f_macro_test_for_no_data_errors(status)) { + if (f_error_is_error(status) || status == f_no_data_on_stop || status == f_no_data_on_eos || status == f_no_data_on_eol) { return f_error_set_error(status); } } diff --git a/level_3/fss_basic_read/c/fss_basic_read.c b/level_3/fss_basic_read/c/fss_basic_read.c index ce1770f..1da3d30 100644 --- a/level_3/fss_basic_read/c/fss_basic_read.c +++ b/level_3/fss_basic_read/c/fss_basic_read.c @@ -131,7 +131,7 @@ extern "C" { // to do this, one must look for any "has_additional" and then see if the "additional" location is set to 0 // nothing can be 0 as that represents the program name, unless argv[] is improperly created } - else if (f_macro_test_for_allocation_errors(status)) { + else if (status == f_allocation_error || status == f_reallocation_error) { fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "CRITICAL ERROR: unable to allocate memory"); } else if (status == f_invalid_parameter) { @@ -186,7 +186,7 @@ extern "C" { else if (status == f_file_read_error) { fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: A read error occurred while accessing the file '%s'", "-"); } - else if (f_macro_test_for_allocation_errors(status)) { + else if (status == f_allocation_error || status == f_reallocation_error) { fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "CRITICAL ERROR: unable to allocate memory"); } else { @@ -276,7 +276,7 @@ extern "C" { else if (status == f_file_read_error) { fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: A read error occurred while accessing the file '%s'", argv[data->remaining.array[counter]]); } - else if (f_macro_test_for_allocation_errors(status)) { + else if (status == f_allocation_error || status == f_reallocation_error) { fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "CRITICAL ERROR: unable to allocate memory"); } else { @@ -330,7 +330,7 @@ extern "C" { if (status == f_invalid_parameter) { fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: Invalid parameter when calling fll_fss_basic_list_read() for the file '%s'", filename); } - else if (f_macro_test_for_allocation_errors(status)) { + else if (status == f_allocation_error || status == f_reallocation_error) { fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "CRITICAL ERROR: unable to allocate memory"); } else if (status == f_incomplete_utf_on_stop) { @@ -346,7 +346,7 @@ extern "C" { fss_basic_read_delete_data(data); return f_error_set_error(status); } - else if (f_macro_test_for_no_data_errors(status)) { + else if (status == f_no_data_on_stop || status == f_no_data_on_eos) { // clear buffers, then attempt the next file f_delete_fss_contents(status2, data->contents); f_delete_fss_objects(status2, data->objects); diff --git a/level_3/fss_basic_write/c/fss_basic_write.c b/level_3/fss_basic_write/c/fss_basic_write.c index 8607d53..9a678d6 100644 --- a/level_3/fss_basic_write/c/fss_basic_write.c +++ b/level_3/fss_basic_write/c/fss_basic_write.c @@ -117,7 +117,7 @@ extern "C" { // to do this, one must look for any "has_additional" and then see if the "additional" location is set to 0 // nothing can be 0 as that represents the program name, unless argv[] is improperly created } - else if (f_macro_test_for_allocation_errors(status)) { + else if (status == f_allocation_error || status == f_reallocation_error) { fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "CRITICAL ERROR: unable to allocate memory."); } else if (status == f_invalid_parameter) { @@ -183,14 +183,14 @@ extern "C" { if (object) { status = fl_fss_basic_object_write(&buffer, input, &location); - if (f_error_is_error(status) || f_macro_test_for_no_data_errors(status)) { + if (f_error_is_error(status) || status == f_no_data_on_stop || status == f_no_data_on_eos) { return f_error_set_error(status); } } else { status = fl_fss_basic_content_write(&buffer, input, &location); - if (f_error_is_error(status) || f_macro_test_for_no_data_errors(status)) { + if (f_error_is_error(status) || status == f_no_data_on_stop || status == f_no_data_on_eos) { return f_error_set_error(status); } } @@ -209,14 +209,14 @@ extern "C" { if (object) { status = fl_fss_basic_object_write(&buffer, input, &location); - if (f_error_is_error(status) || f_macro_test_for_no_data_errors(status)) { + if (f_error_is_error(status) || status == f_no_data_on_stop || status == f_no_data_on_eos) { return f_error_set_error(status); } } else { status = fl_fss_basic_content_write(&buffer, input, &location); - if (f_error_is_error(status) || f_macro_test_for_no_data_errors(status)) { + if (f_error_is_error(status) || status == f_no_data_on_stop || status == f_no_data_on_eos) { return f_error_set_error(status); } } diff --git a/level_3/fss_extended_read/c/fss_extended_read.c b/level_3/fss_extended_read/c/fss_extended_read.c index 0043fe9..a95207a 100644 --- a/level_3/fss_extended_read/c/fss_extended_read.c +++ b/level_3/fss_extended_read/c/fss_extended_read.c @@ -138,7 +138,7 @@ extern "C" { // to do this, one must look for any "has_additional" and then see if the "additional" location is set to 0 // nothing can be 0 as that represents the program name, unless argv[] is improperly created } - else if (f_macro_test_for_allocation_errors(status)) { + else if (status == f_allocation_error || status == f_reallocation_error) { fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "CRITICAL ERROR: unable to allocate memory"); } else if (status == f_invalid_parameter) { @@ -245,14 +245,6 @@ extern "C" { fss_extended_read_delete_data(data); return f_error_set_error(status); } - else if (f_macro_test_for_no_data_errors(status)) { - // clear buffers, then attempt the next file - f_delete_fss_contents(status2, data->contents); - f_delete_fss_objects(status2, data->objects); - f_delete_dynamic_string(status2, data->buffer); - - return f_error_set_warning(status); - } if (data->file_position.total_elements == 0) { fseek(file.file, 0, SEEK_END); @@ -290,7 +282,7 @@ extern "C" { else if (status == f_file_read_error) { fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: A read error occurred while accessing the file '%s'", argv[data->remaining.array[counter]]); } - else if (f_macro_test_for_allocation_errors(status)) { + else if (status == f_allocation_error || status == f_reallocation_error) { fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "CRITICAL ERROR: unable to allocate memory"); } else { @@ -343,7 +335,7 @@ extern "C" { if (status == f_invalid_parameter) { fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: Invalid parameter when calling fll_fss_extended_read() for the file '%s'", filename); } - else if (f_macro_test_for_allocation_errors(status)) { + else if (status == f_allocation_error || status == f_reallocation_error) { fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "CRITICAL ERROR: unable to allocate memory"); } else if (status == f_incomplete_utf_on_stop) { @@ -359,7 +351,7 @@ extern "C" { fss_extended_read_delete_data(data); return f_error_set_error(status); } - else if (f_macro_test_for_no_data_errors(status)) { + else if (status == f_no_data_on_stop || status == f_no_data_on_eos) { // clear buffers, then attempt the next file f_delete_fss_contents(status2, data->contents); f_delete_fss_objects(status2, data->objects); diff --git a/level_3/fss_extended_write/c/fss_extended_write.c b/level_3/fss_extended_write/c/fss_extended_write.c index a7282e9..5f35cbe 100644 --- a/level_3/fss_extended_write/c/fss_extended_write.c +++ b/level_3/fss_extended_write/c/fss_extended_write.c @@ -124,7 +124,7 @@ extern "C" { // to do this, one must look for any "has_additional" and then see if the "additional" location is set to 0 // nothing can be 0 as that represents the program name, unless argv[] is improperly created } - else if (f_macro_test_for_allocation_errors(status)) { + else if (status == f_allocation_error || status == f_reallocation_error) { fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "CRITICAL ERROR: unable to allocate memory."); } else if (status == f_invalid_parameter) { @@ -190,14 +190,14 @@ extern "C" { if (object) { status = fl_fss_extended_object_write(input, &location, &buffer); - if (f_error_is_error(status) || f_macro_test_for_no_data_errors(status)) { + if (f_error_is_error(status) || status == f_no_data_on_stop || status == f_no_data_on_eos) { return f_error_set_error(status); } } else { status = fl_fss_extended_content_write(input, &location, &buffer); - if (f_error_is_error(status) || f_macro_test_for_no_data_errors(status)) { + if (f_error_is_error(status) || status == f_no_data_on_stop || status == f_no_data_on_eos) { return f_error_set_error(status); } @@ -229,7 +229,7 @@ extern "C" { status = fl_fss_extended_object_write(input, &location, &buffer); - if (f_error_is_error(status) || f_macro_test_for_no_data_errors(status)) { + if (f_error_is_error(status) || status == f_no_data_on_stop || status == f_no_data_on_eos) { return f_error_set_error(status); } } @@ -245,7 +245,7 @@ extern "C" { status = fl_fss_extended_content_write(input, &location, &buffer); - if (f_error_is_error(status) || f_macro_test_for_no_data_errors(status)) { + if (f_error_is_error(status) || status == f_no_data_on_stop || status == f_no_data_on_eos) { return f_error_set_error(status); } diff --git a/level_3/fss_status_code/c/fss_status_code.c b/level_3/fss_status_code/c/fss_status_code.c index 4ab2d35..c66fe8f 100644 --- a/level_3/fss_status_code/c/fss_status_code.c +++ b/level_3/fss_status_code/c/fss_status_code.c @@ -136,7 +136,7 @@ extern "C" { // to do this, one must look for any "has_additional" and then see if the "additional" location is set to 0 // nothing can be 0 as that represents the program name, unless argv[] is improperly created } - else if (f_macro_test_for_allocation_errors(status)) { + else if (status == f_allocation_error || status == f_reallocation_error) { fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "CRITICAL ERROR: unable to allocate memory."); } else if (status == f_invalid_parameter) { diff --git a/level_3/init/c/init.c b/level_3/init/c/init.c index 5b7d7d5..0504c3e 100644 --- a/level_3/init/c/init.c +++ b/level_3/init/c/init.c @@ -132,7 +132,7 @@ extern "C" { // TODO: there is a way to identify which parameter is incorrect // to do this, one must look for any "has_additional" and then see if the "additional" location is set to 0 // nothing can be 0 as that represents the program name, unless argv[] is improperly created - } else if (f_macro_test_for_allocation_errors(status)) { + } else if (status == f_allocation_error || status == f_reallocation_error) { fl_print_color_line(f_standard_error, argument->context.error, argument->context.reset, "CRITICAL ERROR: unable to allocate memory"); } else if (f_error_set_fine(status) == f_invalid_parameter) { fl_print_color_line(f_standard_error, argument->context.error, argument->context.reset, "INTERNAL ERROR: Invalid parameter when calling fl_process_parameters()"); diff --git a/level_3/init/c/private-init.c b/level_3/init/c/private-init.c index 026fb75..4d60b86 100644 --- a/level_3/init/c/private-init.c +++ b/level_3/init/c/private-init.c @@ -58,7 +58,7 @@ fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: A seek error occurred while accessing the file '%s'.", filename); } else if (status == f_file_read_error) { fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: A read error occurred while accessing the file '%s'.", filename); - } else if (f_macro_test_for_allocation_errors(status)) { + } else if (status == f_allocation_error || status == f_reallocation_error) { fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "CRITICAL ERROR: unable to allocate memory."); } else { fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: An unhandled error (%u) has occured while calling fl_file_read().", f_error_set_error(status)); @@ -80,7 +80,7 @@ fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: Invalid parameter when calling fll_fss_basic_list_read() for the file '%s'.", filename); } else if (status == f_no_data_on_eos || status == f_no_data || status == f_no_data_on_stop) { fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: No relevant data was found within the file '%s'.", filename); - } else if (f_macro_test_for_allocation_errors(status)) { + } else if (status == f_allocation_error || status == f_reallocation_error) { fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "CRITICAL ERROR: unable to allocate memory."); } else { fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: An unhandled error (%u) has occured while calling fll_fss_basic_list_read() for the file '%s'.", f_error_set_error(status), filename); @@ -107,7 +107,7 @@ if (f_error_is_error(status)) { status = f_error_set_fine(status); - if (f_macro_test_for_allocation_errors(status)) { + if (status == f_allocation_error || status == f_reallocation_error) { fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "CRITICAL ERROR: unable to allocate memory."); } else if (status == f_failure) { // the error message has already been displayed. @@ -499,7 +499,7 @@ fl_print_color_line(f_standard_error, argument.context.error, argument.context.reset, "INTERNAL ERROR: Invalid parameter when calling fll_fss_basic_list_read() for the file '%s'.", init_rule_core_file); } else if (status == f_no_data_on_eos || status == f_no_data || status == f_no_data_on_stop) { fl_print_color_line(f_standard_error, argument.context.error, argument.context.reset, "ERROR: No relevant data was found within the file '%s'.", init_rule_core_file); - } else if (f_macro_test_for_allocation_errors(status)) { + } else if (status == f_allocation_error || status == f_reallocation_error) { fl_print_color_line(f_standard_error, argument.context.error, argument.context.reset, "CRITICAL ERROR: unable to allocate memory."); } else { fl_print_color_line(f_standard_error, argument.context.error, argument.context.reset, "INTERNAL ERROR: An unhandled error (%u) has occured while calling fll_fss_basic_list_read() for the file '%s'.", f_error_set_error(status), init_rule_core_file); @@ -526,7 +526,7 @@ status = fll_fss_extended_read(&buffer, &location, &objects, &contents); if (f_error_is_error(status_process)) { - if (f_macro_test_for_allocation_errors(status)) { + if (status == f_allocation_error || status == f_reallocation_error) { fl_print_color_line(f_standard_error, argument->context.error, argument->context.reset, "CRITICAL ERROR: unable to allocate memory."); } else { @@ -553,7 +553,7 @@ if (f_error_is_error(status)) { status = f_error_set_fine(status); - if (f_macro_test_for_allocation_errors(status)) { + if (status == f_allocation_error || status == f_reallocation_error) { fl_print_color_line(f_standard_error, data->context.error, context.reset, "CRITICAL ERROR: unable to allocate memory."); } else if (status == f_failure) { // the error message has already been displayed. @@ -567,7 +567,7 @@ } } else { - if (f_macro_test_for_allocation_errors(status)) { + if (status == f_allocation_error || status == f_reallocation_error) { fl_print_color_line(f_standard_error, context.error, context.reset, "CRITICAL ERROR: unable to allocate memory."); } else { diff --git a/level_3/status_code/c/status_code.c b/level_3/status_code/c/status_code.c index 7feaffc..9e4fae0 100644 --- a/level_3/status_code/c/status_code.c +++ b/level_3/status_code/c/status_code.c @@ -136,7 +136,7 @@ extern "C" { // to do this, one must look for any "has_additional" and then see if the "additional" location is set to 0 // nothing can be 0 as that represents the program name, unless argv[] is improperly created } - else if (f_macro_test_for_allocation_errors(status)) { + else if (status == f_allocation_error || status == f_reallocation_error) { fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "CRITICAL ERROR: unable to allocate memory."); } else if (status == f_invalid_parameter) {