From 8854606aff171f38311e3f115f2624957dba9b44 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Sun, 20 Sep 2020 19:55:01 -0500 Subject: [PATCH] Cleanup: used !x instead of x == 0. This is a better practice. While a compiler nowadays might optimize x == 0, it is better practice to use !x to represent the logic and reasoning. One should always be aware of simple performance optimizations and practices, even if it might just be compiled away, if the readability is not too difficult. --- level_0/f_console/c/console.c | 32 +-- level_0/f_conversion/c/conversion.c | 18 +- level_0/f_directory/c/directory.c | 14 +- level_0/f_directory/c/directory_type.h | 4 +- level_0/f_directory/c/private-directory.c | 2 +- level_0/f_environment/c/environment.c | 18 +- level_0/f_environment/c/private-environment.c | 4 +- level_0/f_file/c/file.c | 184 +++++++------- level_0/f_file/c/private-file.c | 6 +- level_0/f_fss/c/fss.c | 28 +- level_0/f_fss/c/fss_named.h | 4 +- level_0/f_fss/c/fss_nest.h | 12 +- level_0/f_fss/c/fss_set.h | 8 +- level_0/f_iki/c/iki.c | 12 +- level_0/f_memory/c/memory-structure.h | 4 +- level_0/f_memory/c/memory.c | 14 +- level_0/f_path/c/path.c | 2 +- level_0/f_print/c/print.c | 10 +- level_0/f_print/c/private-print.c | 4 +- level_0/f_serialize/c/serialize.c | 20 +- level_0/f_string/c/string_dynamic.h | 4 +- level_0/f_string/c/string_map.h | 8 +- level_0/f_utf/c/private-utf.c | 4 +- level_0/f_utf/c/utf-common.h | 4 +- level_0/f_utf/c/utf.c | 114 ++++----- level_1/fl_color/c/color.c | 62 ++--- level_1/fl_console/c/console.c | 4 +- level_1/fl_conversion/c/conversion.c | 92 +++---- level_1/fl_directory/c/directory.c | 32 ++- level_1/fl_directory/c/private-directory.c | 24 +- level_1/fl_environment/c/environment.c | 34 +-- level_1/fl_fss/c/fss_basic.c | 20 +- level_1/fl_fss/c/fss_basic_list.c | 20 +- level_1/fl_fss/c/fss_extended.c | 20 +- level_1/fl_fss/c/fss_extended_list.c | 26 +- level_1/fl_fss/c/private-fss.c | 2 +- level_1/fl_print/c/print.c | 60 ++--- level_1/fl_status/c/status.c | 2 +- level_1/fl_string/c/private-string.c | 30 +-- level_1/fl_string/c/string.c | 282 ++++++++++----------- level_1/fl_utf/c/private-utf.c | 22 +- level_1/fl_utf/c/utf.c | 203 ++++++++------- level_1/fl_utf_file/c/private-utf_file.c | 4 +- level_1/fl_utf_file/c/utf_file.c | 44 ++-- level_2/fll_execute/c/execute.c | 74 +++--- level_2/fll_fss/c/fss.c | 110 ++++---- level_2/fll_fss/c/fss_basic.c | 10 +- level_2/fll_fss/c/fss_basic_list.c | 10 +- level_2/fll_fss/c/fss_extended.c | 10 +- level_2/fll_fss/c/fss_extended_list.c | 10 +- level_2/fll_fss/c/fss_status.c | 6 +- level_2/fll_path/c/path.c | 2 +- level_2/fll_program/c/program.c | 16 +- level_2/fll_status/c/status.c | 4 +- level_3/byte_dump/c/private-byte_dump.c | 8 +- level_3/fake/c/private-build.c | 12 +- level_3/fake/c/private-clean.c | 6 +- level_3/fake/c/private-fake.c | 4 +- level_3/fake/c/private-make.c | 18 +- level_3/fake/c/private-skeleton.c | 4 +- .../fss_basic_list_read/c/fss_basic_list_read.c | 4 +- .../c/private-fss_basic_list_read.c | 35 +-- .../c/private-fss_basic_list_read.h | 4 +- level_3/fss_basic_read/c/fss_basic_read.c | 4 +- level_3/fss_basic_read/c/private-fss_basic_read.c | 16 +- level_3/fss_basic_read/c/private-fss_basic_read.h | 4 +- .../c/fss_extended_list_read.c | 4 +- .../c/private-fss_extended_list_read.c | 34 ++- .../c/private-fss_extended_list_read.h | 4 +- level_3/fss_extended_read/c/fss_extended_read.c | 4 +- .../c/private-fss_extended_read.c | 24 +- .../c/private-fss_extended_read.h | 4 +- level_3/iki_read/c/iki_read.c | 4 +- level_3/iki_read/c/iki_read.h | 4 +- 74 files changed, 983 insertions(+), 987 deletions(-) diff --git a/level_0/f_console/c/console.c b/level_0/f_console/c/console.c index 963f40a..451deae 100644 --- a/level_0/f_console/c/console.c +++ b/level_0/f_console/c/console.c @@ -7,12 +7,12 @@ extern "C" { #ifndef _di_f_console_identify_ f_return_status f_console_identify(const f_string_t input, f_console_id_t *result) { #ifndef _di_level_0_parameter_checking_ - if (result == 0) return F_status_set_error(F_parameter); + if (!result) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_f const f_string_length_t length = strnlen(input, 3); - if (length == 0) { + if (!length) { *result = f_console_none; return F_data_not; } @@ -50,7 +50,7 @@ extern "C" { #ifndef _di_f_console_parameter_process_ f_return_status f_console_parameter_process(const f_console_arguments_t arguments, f_console_parameters_t parameters, f_string_lengths_t *remaining) { #ifndef _di_level_0_parameter_checking_ - if (remaining == 0) return F_status_set_error(F_parameter); + if (!remaining) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ f_status_t status = F_none; @@ -147,7 +147,7 @@ extern "C" { } if (result == console_short) { - if (parameters.parameter[i].symbol_short == 0) continue; + if (!parameters.parameter[i].symbol_short) continue; width = f_macro_utf_byte_width_is(arguments.argv[location][sub_location]); if (width > 0) { @@ -184,7 +184,7 @@ extern "C" { } } else if (result == console_long) { - if (parameters.parameter[i].symbol_long == 0) { + if (!parameters.parameter[i].symbol_long) { continue; } @@ -246,7 +246,7 @@ extern "C" { if (parameters.parameter[i].type != f_console_type_other) continue; - if (parameters.parameter[i].symbol_other == 0) continue; + if (!parameters.parameter[i].symbol_other) continue; if (strncmp(arguments.argv[location], parameters.parameter[i].symbol_other, string_length + 1) != 0) continue; @@ -322,12 +322,12 @@ extern "C" { #ifndef _di_f_console_parameter_prioritize_left_ f_return_status f_console_parameter_prioritize_left(const f_console_parameters_t parameters, const f_console_parameter_ids_t choices, f_console_parameter_id_t *decision) { #ifndef _di_level_0_parameter_checking_ - if (decision == 0) return F_status_set_error(F_parameter); - if (choices.id == 0) return F_status_set_error(F_parameter); + if (!decision) return F_status_set_error(F_parameter); + if (!choices.id) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (choices.used == 0) return F_data_not; - if (parameters.used == 0) return F_data_not; + if (!choices.used) return F_data_not; + if (!parameters.used) return F_data_not; f_array_length_t location = 0; f_array_length_t location_sub = 0; @@ -351,7 +351,7 @@ extern "C" { } // for // The first parameter location (argc = 0) is the program name, therefore if the location is 0, then no matches were found. - if (location == 0) { + if (!location) { return F_data_not; } @@ -364,12 +364,12 @@ extern "C" { #ifndef _di_f_console_parameter_prioritize_right_ f_return_status f_console_parameter_prioritize_right(const f_console_parameters_t parameters, const f_console_parameter_ids_t choices, f_console_parameter_id_t *decision) { #ifndef _di_level_0_parameter_checking_ - if (decision == 0) return F_status_set_error(F_parameter); - if (choices.id == 0) return F_status_set_error(F_parameter); + if (!decision) return F_status_set_error(F_parameter); + if (!choices.id) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (choices.used == 0) return F_data_not; - if (parameters.used == 0) return F_data_not; + if (!choices.used) return F_data_not; + if (!parameters.used) return F_data_not; f_array_length_t location = 0; f_array_length_t location_sub = 0; @@ -393,7 +393,7 @@ extern "C" { } // for // The first parameter location (argc = 0) is the program name, therefore if the location is 0, then no matches were found. - if (location == 0) { + if (!location) { return F_data_not; } diff --git a/level_0/f_conversion/c/conversion.c b/level_0/f_conversion/c/conversion.c index 410b961..eb7946b 100644 --- a/level_0/f_conversion/c/conversion.c +++ b/level_0/f_conversion/c/conversion.c @@ -76,7 +76,7 @@ extern "C" { #ifndef _di_f_conversion_character_to_binary_ f_return_status f_conversion_character_to_binary(const int8_t character, f_number_unsigned_t *number) { #ifndef _di_level_0_parameter_checking_ - if (number == 0) return F_status_set_error(F_parameter); + if (!number) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ switch (character) { @@ -93,7 +93,7 @@ extern "C" { #ifndef _di_f_conversion_character_to_decimal_ f_return_status f_conversion_character_to_decimal(const int8_t character, f_number_unsigned_t *number) { #ifndef _di_level_0_parameter_checking_ - if (number == 0) return F_status_set_error(F_parameter); + if (!number) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ switch (character) { @@ -118,7 +118,7 @@ extern "C" { #ifndef _di_f_conversion_character_to_duodecimal_ f_return_status f_conversion_character_to_duodecimal(const int8_t character, f_number_unsigned_t *decimal) { #ifndef _di_level_0_parameter_checking_ - if (decimal == 0) return F_status_set_error(F_parameter); + if (!decimal) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ switch (character) { @@ -147,7 +147,7 @@ extern "C" { #ifndef _di_f_conversion_character_to_hexidecimal_ f_return_status f_conversion_character_to_hexidecimal(const int8_t character, f_number_unsigned_t *decimal) { #ifndef _di_level_0_parameter_checking_ - if (decimal == 0) return F_status_set_error(F_parameter); + if (!decimal) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ switch (character) { @@ -184,7 +184,7 @@ extern "C" { #ifndef _di_f_conversion_character_to_octal_ f_return_status f_conversion_character_to_octal(const int8_t character, f_number_unsigned_t *number) { #ifndef _di_level_0_parameter_checking_ - if (number == 0) return F_status_set_error(F_parameter); + if (!number) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ switch (character) { @@ -207,13 +207,13 @@ extern "C" { #ifndef _di_f_conversion_number_signed_to_string_ f_return_status f_conversion_number_signed_to_string(const f_number_signed_t number, const uint8_t base, f_string_dynamic_t *destination) { #ifndef _di_level_0_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); if (base < 2 || base > 16) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ f_status_t status = F_none; - if (number == 0) { + if (!number) { f_macro_string_dynamic_t_resize(status, (*destination), destination->used + 2); if (F_status_is_error(status)) return status; @@ -328,13 +328,13 @@ extern "C" { #ifndef _di_f_conversion_number_unsigned_to_string_ f_return_status f_conversion_number_unsigned_to_string(const f_number_unsigned_t number, const uint8_t base, f_string_dynamic_t *destination) { #ifndef _di_level_0_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); if (base < 2 || base > 16) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ f_status_t status = F_none; - if (number == 0) { + if (!number) { f_macro_string_dynamic_t_resize(status, (*destination), destination->used + 2); if (F_status_is_error(status)) return status; diff --git a/level_0/f_directory/c/directory.c b/level_0/f_directory/c/directory.c index a8c2dbb..feed6fe 100644 --- a/level_0/f_directory/c/directory.c +++ b/level_0/f_directory/c/directory.c @@ -126,7 +126,7 @@ extern "C" { #ifndef _di_f_directory_list_ f_return_status f_directory_list(const f_string_t path, int (*filter)(const struct dirent *), int (*sort)(const struct dirent **, const struct dirent **), f_string_dynamics_t *names) { #ifndef _di_level_0_parameter_checking_ - if (names == 0) return F_status_set_error(F_parameter); + if (!names) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ struct dirent **listing = 0; @@ -145,7 +145,7 @@ extern "C" { size = strnlen(listing[i]->d_name, f_directory_name_max); // There is no reason to include "." and ".." in the directory listing. - if (strncmp(listing[i]->d_name, "..", 3) == 0 || strncmp(listing[i]->d_name, ".", 2) == 0) { + if (!strncmp(listing[i]->d_name, "..", 3) == 0 || strncmp(listing[i]->d_name, ".", 2)) { f_memory_delete((void **) & listing[i], sizeof(char *), 1); continue; } @@ -172,7 +172,7 @@ extern "C" { f_memory_delete((void **) & listing, sizeof(struct dirent *), 1); if (F_status_is_error(status)) return status; - if (length == 0) return F_data_not; + if (!length) return F_data_not; return F_none; } @@ -181,7 +181,7 @@ extern "C" { #ifndef _di_f_directory_open_ f_return_status f_directory_open(const f_string_t path, const bool dereference, int *id) { #ifndef _di_level_0_parameter_checking_ - if (id == 0) return F_status_set_error(F_parameter); + if (!id) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ int flag = f_directory_flag_directory | f_directory_flag_close_execute | f_directory_flag_path; @@ -219,7 +219,7 @@ extern "C" { f_return_status f_directory_open_at(const int at_id, const f_string_t path, const bool dereference, int *id) { #ifndef _di_level_0_parameter_checking_ if (at_id <= 0) return F_status_set_error(F_parameter); - if (id == 0) return F_status_set_error(F_parameter); + if (!id) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ int flag = f_directory_flag_directory | f_directory_flag_close_execute | f_directory_flag_path; @@ -351,7 +351,7 @@ extern "C" { #ifndef _di_f_directory_touch_ f_return_status f_directory_touch(const f_string_t path, const mode_t mode) { #ifndef _di_level_0_parameter_checking_ - if (path == 0) return F_status_set_error(F_parameter); + if (!path) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ f_status_t status = F_none; @@ -400,7 +400,7 @@ extern "C" { #ifndef _di_f_directory_touch_at_ f_return_status f_directory_touch_at(const int at_id, const f_string_t path, const mode_t mode, const int flag) { #ifndef _di_level_0_parameter_checking_ - if (path == 0) return F_status_set_error(F_parameter); + if (!path) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ f_status_t status = F_none; diff --git a/level_0/f_directory/c/directory_type.h b/level_0/f_directory/c/directory_type.h index 89b7af3..c23345c 100644 --- a/level_0/f_directory/c/directory_type.h +++ b/level_0/f_directory/c/directory_type.h @@ -169,7 +169,7 @@ extern "C" { structures.used--; \ f_macro_directory_status_t_delete_simple(structures.array[structures.used]); \ } \ - if (structures.used == 0) { \ + if (!structures.used) { \ if (f_memory_delete((void **) & structures.array, sizeof(f_directory_status_t), structures.size)) { \ structures.size = 0; \ } \ @@ -181,7 +181,7 @@ extern "C" { structures.used--; \ f_macro_directory_status_t_destroy_simple(structures.array[structures.used]); \ } \ - if (structures.used == 0) { \ + if (!structures.used) { \ if (f_memory_destroy((void **) & structures.array, sizeof(f_directory_status_t), structures.size)) { \ structures.size = 0; \ } \ diff --git a/level_0/f_directory/c/private-directory.c b/level_0/f_directory/c/private-directory.c index 8caa5e3..e6d1233 100644 --- a/level_0/f_directory/c/private-directory.c +++ b/level_0/f_directory/c/private-directory.c @@ -60,7 +60,7 @@ extern "C" { #if !defined(_di_f_directory_remove_) int private_f_directory_remove_recursively(const char *path, const struct stat *file_stat, int type, struct FTW *entity) { - if (entity->level == 0) return 0; + if (!entity->level) return 0; return remove(path); } #endif // !defined(_di_f_directory_remove_) diff --git a/level_0/f_environment/c/environment.c b/level_0/f_environment/c/environment.c index c710075..6be2077 100644 --- a/level_0/f_environment/c/environment.c +++ b/level_0/f_environment/c/environment.c @@ -7,7 +7,7 @@ extern "C" { #ifndef _di_f_environment_clear_ f_return_status f_environment_clear() { - if (clearenv() == 0) { + if (!clearenv()) { return F_none; } @@ -46,9 +46,9 @@ extern "C" { if (value->used > value->size) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (name.used == 0) return F_data_not; + if (!name.used) return F_data_not; - if (name.string[name.used - 1] == 0) { + if (!name.string[name.used - 1]) { return private_f_environment_get(name.string, value); } @@ -74,10 +74,10 @@ extern "C" { if (value.used > value.size) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (name.used == 0) return F_data_not; + if (!name.used) return F_data_not; - if (name.string[name.used - 1] == 0) { - if (value.used > 0 && value.string[value.used - 1] == 0) { + if (!name.string[name.used - 1]) { + if (value.used > 0 && !value.string[value.used - 1]) { return private_f_environment_set(name.string, value.string, replace); } @@ -97,7 +97,7 @@ extern "C" { memcpy(&variable_name, name.string, name.used); variable_name[name.used] = 0; - if (value.used > 0 && value.string[value.used - 1] == 0) { + if (value.used > 0 && !value.string[value.used - 1]) { return private_f_environment_set(variable_name, value.string, replace); } @@ -125,9 +125,9 @@ extern "C" { if (name.used > name.size) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (name.used == 0) return F_data_not; + if (!name.used) return F_data_not; - if (name.string[name.used - 1] == 0) { + if (!name.string[name.used - 1]) { return private_f_environment_unset(name.string); } diff --git a/level_0/f_environment/c/private-environment.c b/level_0/f_environment/c/private-environment.c index c3792c4..413798b 100644 --- a/level_0/f_environment/c/private-environment.c +++ b/level_0/f_environment/c/private-environment.c @@ -9,13 +9,13 @@ extern "C" { f_return_status private_f_environment_get(const f_string_t name, f_string_dynamic_t *value) { const f_string_t result = getenv(name); - if (result == 0) { + if (!result) { return F_exist_not; } const f_string_length_t size = strnlen(result, f_environment_max_length); - if (size == 0) { + if (!size) { value->used = 0; } else { diff --git a/level_0/f_file/c/file.c b/level_0/f_file/c/file.c index 8e6e512..d830795 100644 --- a/level_0/f_file/c/file.c +++ b/level_0/f_file/c/file.c @@ -8,7 +8,7 @@ extern "C" { #ifndef _di_f_file_access_ f_return_status f_file_access(const f_string_t path) { #ifndef _di_level_0_parameter_checking_ - if (path == 0) return F_status_set_error(F_parameter); + if (!path) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ if (access(path, F_OK)) { @@ -31,8 +31,8 @@ extern "C" { #ifndef _di_f_file_clone_ f_return_status f_file_clone(const f_string_t source, const f_string_t destination, const bool role, const f_number_unsigned_t size_block, const bool exclusive) { #ifndef _di_level_0_parameter_checking_ - if (source == 0) return F_status_set_error(F_parameter); - if (destination == 0) return F_status_set_error(F_parameter); + if (!source) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ f_status_t status = F_none; @@ -92,8 +92,8 @@ extern "C" { #ifndef _di_f_file_copy_ f_return_status f_file_copy(const f_string_t source, const f_string_t destination, const f_mode_t mode, const f_number_unsigned_t size_block, const bool exclusive) { #ifndef _di_level_0_parameter_checking_ - if (source == 0) return F_status_set_error(F_parameter); - if (destination == 0) return F_status_set_error(F_parameter); + if (!source) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ f_status_t status = F_none; @@ -201,7 +201,7 @@ extern "C" { #ifndef _di_f_file_create_ f_return_status f_file_create(const f_string_t path, const mode_t mode, const bool exclusive) { #ifndef _di_level_0_parameter_checking_ - if (path == 0) return F_status_set_error(F_parameter); + if (!path) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ return private_f_file_create(path, mode, exclusive); @@ -211,7 +211,7 @@ extern "C" { #ifndef _di_f_file_create_at_ f_return_status f_file_create_at(const int at_id, const f_string_t path, const mode_t mode, const bool exclusive) { #ifndef _di_level_0_parameter_checking_ - if (path == 0) return F_status_set_error(F_parameter); + if (!path) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ return private_f_file_create_at(at_id, path, mode, exclusive); @@ -221,7 +221,7 @@ extern "C" { #ifndef _di_f_file_create_device_ f_return_status f_file_create_device(const f_string_t path, const mode_t mode, const unsigned int major, const unsigned int minor) { #ifndef _di_level_0_parameter_checking_ - if (path == 0) return F_status_set_error(F_parameter); + if (!path) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ @@ -238,7 +238,7 @@ extern "C" { #ifndef _di_f_file_create_device_at_ f_return_status f_file_create_device_at(const int at_id, const f_string_t path, const mode_t mode, const unsigned int major, const unsigned int minor) { #ifndef _di_level_0_parameter_checking_ - if (path == 0) return F_status_set_error(F_parameter); + if (!path) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ if (!f_macro_file_type_is_fifo(mode) && !f_macro_file_type_is_character(mode) && !f_macro_file_type_is_block(mode)) { @@ -254,7 +254,7 @@ extern "C" { #ifndef _di_f_file_create_fifo_ f_return_status f_file_create_fifo(const f_string_t path, const mode_t mode) { #ifndef _di_level_0_parameter_checking_ - if (path == 0) return F_status_set_error(F_parameter); + if (!path) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ return private_f_file_create_fifo(path, mode); @@ -264,7 +264,7 @@ extern "C" { #ifndef _di_f_file_create_fifo_at_ f_return_status f_file_create_fifo_at(const int at_id, const f_string_t path, const mode_t mode) { #ifndef _di_level_0_parameter_checking_ - if (path == 0) return F_status_set_error(F_parameter); + if (!path) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ return private_f_file_create_fifo_at(at_id, path, mode); @@ -274,7 +274,7 @@ extern "C" { #ifndef _di_f_file_create_node_ f_return_status f_file_create_node(const f_string_t path, const mode_t mode, const dev_t device) { #ifndef _di_level_0_parameter_checking_ - if (path == 0) return F_status_set_error(F_parameter); + if (!path) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ if (!f_macro_file_type_is_fifo(mode) && !f_macro_file_type_is_character(mode) && !f_macro_file_type_is_block(mode)) { @@ -288,7 +288,7 @@ extern "C" { #ifndef _di_f_file_create_node_at_ f_return_status f_file_create_node_at(const int at_id, const f_string_t path, const mode_t mode, const dev_t device) { #ifndef _di_level_0_parameter_checking_ - if (path == 0) return F_status_set_error(F_parameter); + if (!path) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ if (!f_macro_file_type_is_fifo(mode) && !f_macro_file_type_is_character(mode) && !f_macro_file_type_is_block(mode)) { @@ -302,7 +302,7 @@ extern "C" { #ifndef _di_f_file_exists_ f_return_status f_file_exists(const f_string_t path) { #ifndef _di_level_0_parameter_checking_ - if (path == 0) return F_status_set_error(F_parameter); + if (!path) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ f_status_t status = F_none; @@ -325,7 +325,7 @@ extern "C" { #ifndef _di_f_file_exists_at_ f_return_status f_file_exists_at(const int at_id, const f_string_t path, const int flag) { #ifndef _di_level_0_parameter_checking_ - if (path == 0) return F_status_set_error(F_parameter); + if (!path) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ f_status_t status = F_none; @@ -354,8 +354,8 @@ extern "C" { #ifndef _di_f_file_group_read_ f_return_status f_file_group_read(const f_string_t path, gid_t *group) { #ifndef _di_level_0_parameter_checking_ - if (path == 0) return F_status_set_error(F_parameter); - if (group == 0) return F_status_set_error(F_parameter); + if (!path) return F_status_set_error(F_parameter); + if (!group) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ struct stat stat_file; @@ -376,7 +376,7 @@ extern "C" { #ifndef _di_f_file_is_ f_return_status f_file_is(const f_string_t path, const int type, const bool dereference) { #ifndef _di_level_0_parameter_checking_ - if (path == 0) return F_status_set_error(F_parameter); + if (!path) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ struct stat file_stat; @@ -395,7 +395,7 @@ extern "C" { #ifndef _di_f_file_is_at_ f_return_status f_file_is_at(const int at_id, const f_string_t path, const int type, const int flag) { #ifndef _di_level_0_parameter_checking_ - if (path == 0) return F_status_set_error(F_parameter); + if (!path) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ struct stat file_stat; @@ -425,8 +425,8 @@ extern "C" { #ifndef _di_f_file_link_ f_return_status f_file_link(const f_string_t target, const f_string_t point) { #ifndef _di_level_0_parameter_checking_ - if (target == 0) return F_status_set_error(F_parameter); - if (point == 0) return F_status_set_error(F_parameter); + if (!target) return F_status_set_error(F_parameter); + if (!point) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ return private_f_file_link(target, point); @@ -436,8 +436,8 @@ extern "C" { #ifndef _di_f_file_link_at_ f_return_status f_file_link_at(const int at_id, const f_string_t target, const f_string_t point) { #ifndef _di_level_0_parameter_checking_ - if (target == 0) return F_status_set_error(F_parameter); - if (point == 0) return F_status_set_error(F_parameter); + if (!target) return F_status_set_error(F_parameter); + if (!point) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ return private_f_file_link_at(at_id, target, point); @@ -447,8 +447,8 @@ extern "C" { #ifndef _di_f_file_link_hard_ f_return_status f_file_link_hard(const f_string_t target, const f_string_t point) { #ifndef _di_level_0_parameter_checking_ - if (target == 0) return F_status_set_error(F_parameter); - if (point == 0) return F_status_set_error(F_parameter); + if (!target) return F_status_set_error(F_parameter); + if (!point) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ if (link(target, point) < 0) { @@ -479,8 +479,8 @@ extern "C" { #ifndef _di_f_file_link_hard_at_ f_return_status f_file_link_hard_at(const int at_id_target, const int at_id_point, const f_string_t target, const f_string_t point, const int flag) { #ifndef _di_level_0_parameter_checking_ - if (target == 0) return F_status_set_error(F_parameter); - if (point == 0) return F_status_set_error(F_parameter); + if (!target) return F_status_set_error(F_parameter); + if (!point) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ if (linkat(at_id_target, target, at_id_point, point, flag) < 0) { @@ -512,9 +512,9 @@ extern "C" { #ifndef _di_f_file_link_read_ f_return_status f_file_link_read(const f_string_t path, const struct stat link_stat, f_string_dynamic_t *target) { #ifndef _di_level_0_parameter_checking_ - if (path == 0) return F_status_set_error(F_parameter); - if (link_stat.st_size == 0) return F_status_set_error(F_parameter); - if (target == 0) return F_status_set_error(F_parameter); + if (!path) return F_status_set_error(F_parameter); + if (!link_stat.st_size) return F_status_set_error(F_parameter); + if (!target) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ return private_f_file_link_read(path, link_stat, target); @@ -524,8 +524,8 @@ extern "C" { #ifndef _di_f_file_link_read_at_ f_return_status f_file_link_read_at(const int at_id, const f_string_t path, const struct stat link_stat, f_string_dynamic_t *target) { #ifndef _di_level_0_parameter_checking_ - if (link_stat.st_size == 0) return F_status_set_error(F_parameter); - if (target == 0) return F_status_set_error(F_parameter); + if (!link_stat.st_size) return F_status_set_error(F_parameter); + if (!target) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ return private_f_file_link_read_at(at_id, path, link_stat, target); @@ -535,7 +535,7 @@ extern "C" { #ifndef _di_f_file_mode_determine_ f_return_status f_file_mode_determine(const mode_t mode_file, const f_file_mode_t mode_change, const uint8_t mode_replace, const bool directory_is, mode_t *mode) { #ifndef _di_level_0_parameter_checking_ - if (mode == 0) return F_status_set_error(F_parameter); + if (!mode) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ f_file_mode_t change = mode_change & f_file_mode_t_block_special; @@ -841,10 +841,10 @@ extern "C" { #ifndef _di_f_file_mode_from_string_ f_return_status f_file_mode_from_string(const f_string_t string, const mode_t umask, f_file_mode_t *mode, uint8_t *replace) { #ifndef _di_level_0_parameter_checking_ - if (string == 0) return F_status_set_error(F_parameter); - if (string[0] == 0) return F_status_set_error(F_parameter); - if (mode == 0) return F_status_set_error(F_parameter); - if (replace == 0) return F_status_set_error(F_parameter); + if (!string) return F_status_set_error(F_parameter); + if (!string[0]) return F_status_set_error(F_parameter); + if (!mode) return F_status_set_error(F_parameter); + if (!replace) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ uint8_t syntax = 0; @@ -1171,7 +1171,7 @@ extern "C" { else if (how == 2) { // if there are only '0's then the standard and setuid/setgid/sticky bits are to be replaced. - if (*mode == 0) { + if (!*mode) { *replace = f_file_mode_t_replace_standard | f_file_mode_t_replace_special; } } @@ -1192,8 +1192,8 @@ extern "C" { #ifndef _di_f_file_mode_read_ f_return_status f_file_mode_read(const f_string_t path, mode_t *mode) { #ifndef _di_level_0_parameter_checking_ - if (path == 0) return F_status_set_error(F_parameter); - if (mode == 0) return F_status_set_error(F_parameter); + if (!path) return F_status_set_error(F_parameter); + if (!mode) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ struct stat stat_file; @@ -1214,8 +1214,8 @@ extern "C" { #ifndef _di_f_file_mode_read_at_ f_return_status f_file_mode_read_at(const int at_id, const f_string_t path, mode_t *mode) { #ifndef _di_level_0_parameter_checking_ - if (path == 0) return F_status_set_error(F_parameter); - if (mode == 0) return F_status_set_error(F_parameter); + if (!path) return F_status_set_error(F_parameter); + if (!mode) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ struct stat stat_file; @@ -1236,7 +1236,7 @@ extern "C" { #ifndef _di_f_file_mode_set_ f_return_status f_file_mode_set(const f_string_t path, const mode_t mode) { #ifndef _di_level_0_parameter_checking_ - if (path == 0) return F_status_set_error(F_parameter); + if (!path) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ return private_f_file_mode_set(path, mode); @@ -1246,7 +1246,7 @@ extern "C" { #ifndef _di_f_file_mode_set_at_ f_return_status f_file_mode_set_at(const int at_id, const f_string_t path, const mode_t mode) { #ifndef _di_level_0_parameter_checking_ - if (path == 0) return F_status_set_error(F_parameter); + if (!path) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ return private_f_file_mode_set_at(at_id, path, mode); @@ -1256,7 +1256,7 @@ extern "C" { #ifndef _di_f_file_mode_to_mode_ f_return_status f_file_mode_to_mode(const f_file_mode_t from, mode_t *to) { #ifndef _di_level_0_parameter_checking_ - if (to == 0) return F_status_set_error(F_parameter); + if (!to) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ const f_file_mode_t add = from & f_file_mode_t_mask_how_add; @@ -1318,8 +1318,8 @@ extern "C" { #ifndef _di_f_file_name_base_ f_return_status f_file_name_base(const f_string_t path, const f_string_length_t length, f_string_dynamic_t *name_base) { #ifndef _di_level_0_parameter_checking_ - if (path == 0) return F_status_set_error(F_parameter); - if (name_base == 0) return F_status_set_error(F_parameter); + if (!path) return F_status_set_error(F_parameter); + if (!name_base) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ // POSIX basename() modifies the path, so protect it (and add a terminating NULL). @@ -1354,8 +1354,8 @@ extern "C" { #ifndef _di_f_file_name_directory_ f_return_status f_file_name_directory(const f_string_t path, const f_string_length_t length, f_string_dynamic_t *name_directory) { #ifndef _di_level_0_parameter_checking_ - if (path == 0) return F_status_set_error(F_parameter); - if (name_directory == 0) return F_status_set_error(F_parameter); + if (!path) return F_status_set_error(F_parameter); + if (!name_directory) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ // POSIX dirname() modifies the path, so protect it (and add a terminating NULL). @@ -1390,8 +1390,8 @@ extern "C" { #ifndef _di_f_file_open_ f_return_status f_file_open(const f_string_t path, const mode_t mode, f_file_t *file) { #ifndef _di_level_0_parameter_checking_ - if (path == 0) return F_status_set_error(F_parameter); - if (file == 0) return F_status_set_error(F_parameter); + if (!path) return F_status_set_error(F_parameter); + if (!file) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ return private_f_file_open(path, mode, file); @@ -1401,7 +1401,7 @@ extern "C" { #ifndef _di_f_file_open_at_ f_return_status f_file_open_at(const int at_id, const f_string_t path, const mode_t mode, f_file_t *file) { #ifndef _di_level_0_parameter_checking_ - if (file == 0) return F_status_set_error(F_parameter); + if (!file) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ return private_f_file_open_at(at_id, path, mode, file); @@ -1411,8 +1411,8 @@ extern "C" { #ifndef _di_f_file_owner_read_ f_return_status f_file_owner_read(const f_string_t path, uid_t *owner) { #ifndef _di_level_0_parameter_checking_ - if (path == 0) return F_status_set_error(F_parameter); - if (owner == 0) return F_status_set_error(F_parameter); + if (!path) return F_status_set_error(F_parameter); + if (!owner) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ struct stat stat_file; @@ -1433,7 +1433,7 @@ extern "C" { #ifndef _di_f_file_read_ f_return_status f_file_read(const f_file_t file, f_string_dynamic_t *buffer) { #ifndef _di_level_0_parameter_checking_ - if (file.size_read == 0) return F_status_set_error(F_parameter); + if (!file.size_read) return F_status_set_error(F_parameter); if (buffer->used > buffer->size) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ @@ -1461,7 +1461,7 @@ extern "C" { buffer->used += size_read; } // while - if (size_read == 0) { + if (!size_read) { return F_none_eof; } @@ -1484,7 +1484,7 @@ extern "C" { #ifndef _di_f_file_read_block_ f_return_status f_file_read_block(const f_file_t file, f_string_dynamic_t *buffer) { #ifndef _di_level_0_parameter_checking_ - if (file.size_read == 0) return F_status_set_error(F_parameter); + if (!file.size_read) return F_status_set_error(F_parameter); if (buffer->used > buffer->size) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ @@ -1511,7 +1511,7 @@ extern "C" { buffer->used += size_read; } - if (size_read == 0) { + if (!size_read) { return F_none_eof; } @@ -1534,7 +1534,7 @@ extern "C" { #ifndef _di_f_file_read_until_ f_return_status f_file_read_until(const f_file_t file, const f_string_length_t total, f_string_dynamic_t *buffer) { #ifndef _di_level_0_parameter_checking_ - if (file.size_read == 0) return F_status_set_error(F_parameter); + if (!file.size_read) return F_status_set_error(F_parameter); if (buffer->used > buffer->size) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ @@ -1570,7 +1570,7 @@ extern "C" { buffer_count += size_read; } // while - if (size_read == 0) { + if (!size_read) { return F_none_eof; } @@ -1593,7 +1593,7 @@ extern "C" { #ifndef _di_f_file_remove_ f_return_status f_file_remove(const f_string_t path) { #ifndef _di_level_0_parameter_checking_ - if (path == 0) return F_status_set_error(F_parameter); + if (!path) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ if (unlink(path) < 0) { @@ -1620,7 +1620,7 @@ extern "C" { #ifndef _di_f_file_remove_at_ f_return_status f_file_remove_at(const int at_id, const f_string_t path, const int flag) { #ifndef _di_level_0_parameter_checking_ - if (path == 0) return F_status_set_error(F_parameter); + if (!path) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ if (unlinkat(at_id, path, flag) < 0) { @@ -1648,8 +1648,8 @@ extern "C" { #ifndef _di_f_file_rename_ f_return_status f_file_rename(const f_string_t source, const f_string_t destination) { #ifndef _di_level_0_parameter_checking_ - if (source == 0) return F_status_set_error(F_parameter); - if (destination == 0) return F_status_set_error(F_parameter); + if (!source) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ if (rename(source, destination) < 0) { @@ -1682,8 +1682,8 @@ extern "C" { #ifndef _di_f_file_rename_at_ f_return_status f_file_rename_at(const int at_id, const int to_id, const f_string_t source, const f_string_t destination) { #ifndef _di_level_0_parameter_checking_ - if (source == 0) return F_status_set_error(F_parameter); - if (destination == 0) return F_status_set_error(F_parameter); + if (!source) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ if (renameat(at_id, source, to_id, destination) < 0) { @@ -1717,7 +1717,7 @@ extern "C" { #ifndef _di_f_file_role_change_ f_return_status f_file_role_change(const f_string_t path, const uid_t uid, const gid_t gid, const bool dereference) { #ifndef _di_level_0_parameter_checking_ - if (path == 0) return F_status_set_error(F_parameter); + if (!path) return F_status_set_error(F_parameter); if (uid == -1 && gid == -1) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ @@ -1728,7 +1728,7 @@ extern "C" { #ifndef _di_f_file_role_change_at_ f_return_status f_file_role_change_at(const int at_id, const f_string_t path, const uid_t uid, const gid_t gid, const int flag) { #ifndef _di_level_0_parameter_checking_ - if (path == 0) return F_status_set_error(F_parameter); + if (!path) return F_status_set_error(F_parameter); if (uid == -1 && gid == -1) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ @@ -1762,8 +1762,8 @@ extern "C" { #ifndef _di_f_file_size_ f_return_status f_file_size(const f_string_t path, const bool dereference, f_string_length_t *size) { #ifndef _di_level_0_parameter_checking_ - if (path == 0) return F_status_set_error(F_parameter); - if (size == 0) return F_status_set_error(F_parameter); + if (!path) return F_status_set_error(F_parameter); + if (!size) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ struct stat file_stat; @@ -1783,9 +1783,9 @@ extern "C" { #ifndef _di_f_file_size_at_ f_return_status f_file_size_at(const int at_id, const f_string_t path, const bool dereference, f_string_length_t *size) { #ifndef _di_level_0_parameter_checking_ - if (path == 0) return F_status_set_error(F_parameter); + if (!path) return F_status_set_error(F_parameter); if (at_id <= 0) return F_status_set_error(F_parameter); - if (size == 0) return F_status_set_error(F_parameter); + if (!size) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ struct stat file_stat; @@ -1806,7 +1806,7 @@ extern "C" { f_return_status f_file_size_by_id(const int id, f_string_length_t *size) { #ifndef _di_level_0_parameter_checking_ if (id <= 0) return F_status_set_error(F_parameter); - if (size == 0) return F_status_set_error(F_parameter); + if (!size) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ struct stat file_stat; @@ -1826,8 +1826,8 @@ extern "C" { #ifndef _di_f_file_stat_ f_return_status f_file_stat(const f_string_t path, const bool dereference, struct stat *file_stat) { #ifndef _di_level_0_parameter_checking_ - if (path == 0) return F_status_set_error(F_parameter); - if (file_stat == 0) return F_status_set_error(F_parameter); + if (!path) return F_status_set_error(F_parameter); + if (!file_stat) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ return private_f_file_stat(path, dereference, file_stat); @@ -1837,9 +1837,9 @@ extern "C" { #ifndef _di_f_file_stat_at_ f_return_status f_file_stat_at(const int at_id, const f_string_t path, const int flag, struct stat *file_stat) { #ifndef _di_level_0_parameter_checking_ - if (path == 0) return F_status_set_error(F_parameter); + if (!path) return F_status_set_error(F_parameter); if (at_id <= 0) return F_status_set_error(F_parameter); - if (file_stat == 0) return F_status_set_error(F_parameter); + if (!file_stat) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ return private_f_file_stat_at(at_id, path, flag, file_stat); @@ -1850,7 +1850,7 @@ extern "C" { f_return_status f_file_stat_by_id(const int id, struct stat *file_stat) { #ifndef _di_level_0_parameter_checking_ if (id <= 0) return F_status_set_error(F_parameter); - if (file_stat == 0) return F_status_set_error(F_parameter); + if (!file_stat) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ return private_f_file_stat_by_id(id, file_stat); @@ -1860,7 +1860,7 @@ extern "C" { #ifndef _di_f_file_touch_ f_return_status f_file_touch(const f_string_t path, const mode_t mode, const bool dereference) { #ifndef _di_level_0_parameter_checking_ - if (path == 0) return F_status_set_error(F_parameter); + if (!path) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ f_status_t status = F_none; @@ -1900,7 +1900,7 @@ extern "C" { #ifndef _di_f_file_touch_at_ f_return_status f_file_touch_at(const int at_id, const f_string_t path, const mode_t mode, const int flag) { #ifndef _di_level_0_parameter_checking_ - if (path == 0) return F_status_set_error(F_parameter); + if (!path) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ f_status_t status = F_none; @@ -1940,8 +1940,8 @@ extern "C" { #ifndef _di_f_file_type_ f_return_status f_file_type(const f_string_t path, int *type) { #ifndef _di_level_0_parameter_checking_ - if (path == 0) return F_status_set_error(F_parameter); - if (type == 0) return F_status_set_error(F_parameter); + if (!path) return F_status_set_error(F_parameter); + if (!type) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ struct stat file_stat; @@ -1970,8 +1970,8 @@ extern "C" { #ifndef _di_f_file_type_at_ f_return_status f_file_type_at(const int at_id, const f_string_t path, const int flag, int *type) { #ifndef _di_level_0_parameter_checking_ - if (path == 0) return F_status_set_error(F_parameter); - if (type == 0) return F_status_set_error(F_parameter); + if (!path) return F_status_set_error(F_parameter); + if (!type) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ struct stat file_stat; @@ -2001,13 +2001,13 @@ extern "C" { #ifndef _di_f_file_write_ f_return_status f_file_write(const f_file_t file, const f_string_static_t buffer, f_string_length_t *written) { #ifndef _di_level_0_parameter_checking_ - if (file.size_write == 0) return F_status_set_error(F_parameter); + if (!file.size_write) return F_status_set_error(F_parameter); if (buffer.used > buffer.size) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ if (file.id == -1) return F_status_set_error(F_file_closed); - if (buffer.used == 0) { + if (!buffer.used) { if (written) *written = 0; return F_data_not; } @@ -2036,13 +2036,13 @@ extern "C" { #ifndef _di_f_file_write_block_ f_return_status f_file_write_block(const f_file_t file, const f_string_static_t buffer, f_string_length_t *written) { #ifndef _di_level_0_parameter_checking_ - if (file.size_write == 0) return F_status_set_error(F_parameter); + if (!file.size_write) return F_status_set_error(F_parameter); if (buffer.used > buffer.size) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ if (file.id == -1) return F_status_set_error(F_file_closed); - if (buffer.used == 0) { + if (!buffer.used) { if (written) *written = 0; return F_data_not; } @@ -2081,13 +2081,13 @@ extern "C" { #ifndef _di_f_file_write_until_ f_return_status f_file_write_until(const f_file_t file, const f_string_static_t buffer, const f_string_length_t total, f_string_length_t *written) { #ifndef _di_level_0_parameter_checking_ - if (file.size_write == 0) return F_status_set_error(F_parameter); + if (!file.size_write) return F_status_set_error(F_parameter); if (buffer.used > buffer.size) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ if (file.id == -1) return F_status_set_error(F_file_closed); - if (buffer.used == 0 || total == 0) { + if (!buffer.used || !total) { if (written) *written = 0; return F_data_not; } @@ -2126,7 +2126,7 @@ extern "C" { #ifndef _di_f_file_write_range_ f_return_status f_file_write_range(const f_file_t file, const f_string_static_t buffer, const f_string_range_t range, f_string_length_t *written) { #ifndef _di_level_0_parameter_checking_ - if (file.size_write == 0) return F_status_set_error(F_parameter); + if (!file.size_write) return F_status_set_error(F_parameter); if (buffer.used > buffer.size) return F_status_set_error(F_parameter); if (range.stop < range.start) return F_status_set_error(F_parameter); if (range.start >= buffer.used) return F_status_set_error(F_parameter); @@ -2134,7 +2134,7 @@ extern "C" { if (file.id == -1) return F_status_set_error(F_file_closed); - if (buffer.used == 0) { + if (!buffer.used) { if (written) *written = 0; return F_data_not; } diff --git a/level_0/f_file/c/private-file.c b/level_0/f_file/c/private-file.c index 2216647..68342a8 100644 --- a/level_0/f_file/c/private-file.c +++ b/level_0/f_file/c/private-file.c @@ -501,7 +501,7 @@ extern "C" { #if !defined(_di_f_file_open_) || !defined(_di_f_file_copy_) f_return_status private_f_file_open(const f_string_t path, const mode_t mode, f_file_t *file) { - if (mode == 0) { + if (!mode) { file->id = open(path, file->flag); } else { @@ -539,7 +539,7 @@ extern "C" { #if !defined(_di_f_file_open_at_) || !defined(_di_f_file_copy_at_) f_return_status private_f_file_open_at(const int at_id, const f_string_t path, const mode_t mode, f_file_t *file) { - if (mode == 0) { + if (!mode) { file->id = openat(at_id, path, file->flag); } else { @@ -744,7 +744,7 @@ extern "C" { } } // while - if (size_write == 0) { + if (!size_write) { return F_none_stop; } diff --git a/level_0/f_fss/c/fss.c b/level_0/f_fss/c/fss.c index 8d9cb07..9ddc992 100644 --- a/level_0/f_fss/c/fss.c +++ b/level_0/f_fss/c/fss.c @@ -7,9 +7,9 @@ extern "C" { #ifndef _di_f_fss_count_lines_ f_return_status f_fss_count_lines(const f_string_static_t buffer, const f_string_length_t before, f_string_length_t *line) { #ifndef _di_level_0_parameter_checking_ - if (buffer.used == 0) return F_status_set_error(F_parameter); + if (!buffer.used) return F_status_set_error(F_parameter); if (before >= buffer.used) return F_status_set_error(F_parameter); - if (line == 0) return F_status_set_error(F_parameter); + if (!line) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ f_string_length_t i = before; @@ -31,12 +31,12 @@ extern "C" { #ifndef _di_f_fss_count_lines_range_ f_return_status f_fss_count_lines_range(const f_string_static_t buffer, const f_string_range_t range, const f_string_length_t before, f_string_length_t *line) { #ifndef _di_level_0_parameter_checking_ - if (buffer.used == 0) return F_status_set_error(F_parameter); + if (!buffer.used) return F_status_set_error(F_parameter); if (range.start > range.stop) return F_status_set_error(F_parameter); if (range.start >= buffer.used) return F_status_set_error(F_parameter); if (before >= buffer.used) return F_status_set_error(F_parameter); if (before > range.stop) return F_status_set_error(F_parameter); - if (line == 0) return F_status_set_error(F_parameter); + if (!line) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ f_string_length_t i = before; @@ -58,7 +58,7 @@ extern "C" { #ifndef _di_f_fss_is_graph_ f_return_status f_fss_is_graph(const f_string_static_t buffer, const f_string_range_t range) { #ifndef _di_level_0_parameter_checking_ - if (buffer.used == 0) return F_status_set_error(F_parameter); + if (!buffer.used) return F_status_set_error(F_parameter); if (range.start < 0) return F_status_set_error(F_parameter); if (range.stop < range.start) return F_status_set_error(F_parameter); if (range.start >= buffer.used) return F_status_set_error(F_parameter); @@ -77,7 +77,7 @@ extern "C" { #ifndef _di_f_fss_is_space_ f_return_status f_fss_is_space(const f_string_static_t buffer, const f_string_range_t range) { #ifndef _di_level_0_parameter_checking_ - if (buffer.used == 0) return F_status_set_error(F_parameter); + if (!buffer.used) return F_status_set_error(F_parameter); if (range.start < 0) return F_status_set_error(F_parameter); if (range.stop < range.start) return F_status_set_error(F_parameter); if (range.start >= buffer.used) return F_status_set_error(F_parameter); @@ -114,7 +114,7 @@ extern "C" { #ifndef _di_f_fss_is_zero_width_ f_return_status f_fss_is_zero_width(const f_string_static_t buffer, const f_string_range_t range) { #ifndef _di_level_0_parameter_checking_ - if (buffer.used == 0) return F_status_set_error(F_parameter); + if (!buffer.used) return F_status_set_error(F_parameter); if (range.start < 0) return F_status_set_error(F_parameter); if (range.stop < range.start) return F_status_set_error(F_parameter); if (range.start >= buffer.used) return F_status_set_error(F_parameter); @@ -133,7 +133,7 @@ extern "C" { #ifndef _di_f_fss_shift_delimiters_ f_return_status f_fss_shift_delimiters(f_string_dynamic_t *buffer, const f_string_range_t range) { #ifndef _di_level_0_parameter_checking_ - if (buffer->used == 0) return F_status_set_error(F_parameter); + if (!buffer->used) return F_status_set_error(F_parameter); if (range.start < 0) return F_status_set_error(F_parameter); if (range.stop < range.start) return F_status_set_error(F_parameter); if (range.start >= buffer->used) return F_status_set_error(F_parameter); @@ -199,8 +199,8 @@ extern "C" { #ifndef _di_f_fss_skip_past_space_ f_return_status f_fss_skip_past_space(const f_string_static_t buffer, f_string_range_t *range) { #ifndef _di_level_0_parameter_checking_ - if (buffer.used == 0) return F_status_set_error(F_parameter); - if (range == 0) return F_status_set_error(F_parameter); + if (!buffer.used) return F_status_set_error(F_parameter); + if (!range) return F_status_set_error(F_parameter); if (range->start > range->stop) return F_status_set_error(F_parameter); if (range->start >= buffer.used) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ @@ -242,7 +242,7 @@ extern "C" { width = f_macro_utf_byte_width_is(buffer.string[range->start]); - if (width == 0) { + if (!width) { width = 1; } // Do not operate on UTF-8 fragments that are not the first byte of the character. @@ -273,8 +273,8 @@ extern "C" { #ifndef _di_f_fss_skip_past_non_graph_ f_return_status f_fss_skip_past_non_graph(const f_string_static_t buffer, f_string_range_t *range) { #ifndef _di_level_0_parameter_checking_ - if (buffer.used == 0) return F_status_set_error(F_parameter); - if (range == 0) return F_status_set_error(F_parameter); + if (!buffer.used) return F_status_set_error(F_parameter); + if (!range) return F_status_set_error(F_parameter); if (range->start > range->stop) return F_status_set_error(F_parameter); if (range->start >= buffer.used) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ @@ -340,7 +340,7 @@ extern "C" { width = f_macro_utf_byte_width_is(buffer.string[range->start]); - if (width == 0) { + if (!width) { width = 1; } // Do not operate on UTF-8 fragments that are not the first byte of the character. diff --git a/level_0/f_fss/c/fss_named.h b/level_0/f_fss/c/fss_named.h index dcbc0a4..70f0453 100644 --- a/level_0/f_fss/c/fss_named.h +++ b/level_0/f_fss/c/fss_named.h @@ -192,7 +192,7 @@ extern "C" { while (sets.used > 0) { \ sets.used--; \ f_macro_fss_named_t_delete_simple(sets.array[sets.used]); \ - if (sets.used == 0) { \ + if (!sets.used) { \ if (f_memory_delete((void **) & sets.array, sizeof(f_fss_named_t), sets.size)) { \ sets.size = 0; \ } \ @@ -209,7 +209,7 @@ extern "C" { while (sets.used > 0) { \ sets.used--; \ f_macro_fss_named_t_destroy_simple(sets.array[sets.used]); \ - if (sets.used == 0) { \ + if (!sets.used) { \ if (f_memory_destroy((void **) & sets.array, sizeof(f_fss_named_t), sets.size)) { \ sets.size = 0; \ } \ diff --git a/level_0/f_fss/c/fss_nest.h b/level_0/f_fss/c/fss_nest.h index 88910a0..72262c4 100644 --- a/level_0/f_fss/c/fss_nest.h +++ b/level_0/f_fss/c/fss_nest.h @@ -249,7 +249,7 @@ extern "C" { while (items.used > 0) { \ items.used--; \ f_macro_fss_item_t_delete_simple(items.array[items.used]); \ - if (items.used == 0) { \ + if (!items.used) { \ if (f_memory_delete((void **) & items.array, sizeof(f_fss_item_t), items.size)) { \ items.size = 0; \ } \ @@ -266,7 +266,7 @@ extern "C" { while (items.used > 0) { \ items.used--; \ f_macro_fss_item_t_destroy_simple(status, items.array[items.used]); \ - if (items.used == 0) { \ + if (!items.used) { \ if (f_memory_destroy((void **) & items.array, sizeof(f_fss_item_t), items.size)) { \ items.size = 0; \ } \ @@ -423,7 +423,7 @@ extern "C" { while (nest.used > 0) { \ nest.used--; \ f_macro_fss_items_t_delete_simple(nest.depth[nest.used]); \ - if (nest.used == 0) { \ + if (!nest.used) { \ if (f_memory_delete((void **) & nest.depth, sizeof(f_fss_items_t), nest.size)) { \ nest.size = 0; \ } \ @@ -440,7 +440,7 @@ extern "C" { while (nest.used > 0) { \ nest.used--; \ f_macro_fss_items_t_destroy_simple(nest.depth[nest.used]); \ - if (nest.used == 0) { \ + if (!nest.used) { \ if (f_memory_destroy((void **) & nest.depth, sizeof(f_fss_items_t), nest.size)) { \ nest.size = 0; \ } \ @@ -592,7 +592,7 @@ extern "C" { while (nests.used > 0) { \ nests.used--; \ f_macro_fss_nest_t_delete_simple(nests.array[nests.used]); \ - if (nests.used == 0) { \ + if (!nests.used) { \ if (f_memory_delete((void **) & nests.array, sizeof(f_fss_nest_t), nests.size)) { \ nests.size = 0; \ } \ @@ -609,7 +609,7 @@ extern "C" { while (nests.used > 0) { \ nests.used--; \ f_macro_fss_nest_t_destroy_simple(nests.array[nests.used]); \ - if (nests.used == 0) { \ + if (!nests.used) { \ if (f_memory_destroy((void **) & nests.array, sizeof(f_fss_nest_t), nests.size)) { \ nests.size = 0; \ } \ diff --git a/level_0/f_fss/c/fss_set.h b/level_0/f_fss/c/fss_set.h index d358132..fa421a5 100644 --- a/level_0/f_fss/c/fss_set.h +++ b/level_0/f_fss/c/fss_set.h @@ -168,7 +168,7 @@ extern "C" { while (sets.used > 0) { \ sets.used--; \ f_macro_fss_set_t_delete_simple(sets.array[sets.used]); \ - if (sets.used == 0) { \ + if (!sets.used) { \ if (f_memory_delete((void **) & sets.array, sizeof(f_fss_set_t), sets.size)) { \ sets.size = 0; \ } \ @@ -185,7 +185,7 @@ extern "C" { while (sets.used > 0) { \ sets.used--; \ f_macro_fss_set_t_destroy_simple(sets.array[sets.used]); \ - if (sets.used == 0) { \ + if (!sets.used) { \ if (f_memory_destroy((void **) & sets.array, sizeof(f_fss_set_t), sets.size)) { \ sets.size = 0; \ } \ @@ -438,7 +438,7 @@ extern "C" { while (sets.used > 0) { \ sets.used--; \ f_macro_fss_set_quoted_t_delete_simple(sets.array[sets.used]); \ - if (sets.used == 0) { \ + if (!sets.used) { \ if (f_memory_delete((void **) & sets.array, sizeof(f_fss_set_quoted_t), sets.size)) { \ sets.size = 0; \ } \ @@ -455,7 +455,7 @@ extern "C" { while (sets.used > 0) { \ sets.used--; \ f_macro_fss_set_quoted_t_destroy_simple(sets.array[sets.used]); \ - if (sets.used == 0) { \ + if (!sets.used) { \ if (f_memory_destroy((void **) & sets.array, sizeof(f_fss_set_quoted_t), sets.size)) { \ sets.size = 0; \ } \ diff --git a/level_0/f_iki/c/iki.c b/level_0/f_iki/c/iki.c index f196c6d..0c5e1ef 100644 --- a/level_0/f_iki/c/iki.c +++ b/level_0/f_iki/c/iki.c @@ -58,12 +58,12 @@ extern "C" { #ifndef _di_f_iki_read_ f_return_status f_iki_read(f_string_static_t *buffer, f_string_range_t *range, f_iki_variable_t *variable, f_iki_vocabulary_t *vocabulary, f_iki_content_t *content) { #ifndef _di_level_0_parameter_checking_ - if (buffer == 0) return F_status_set_error(F_parameter); - if (buffer->used == 0) return F_status_set_error(F_parameter); - if (range == 0) return F_status_set_error(F_parameter); - if (variable == 0) return F_status_set_error(F_parameter); - if (vocabulary == 0) return F_status_set_error(F_parameter); - if (content == 0) return F_status_set_error(F_parameter); + if (!buffer) return F_status_set_error(F_parameter); + if (!buffer->used) return F_status_set_error(F_parameter); + if (!range) return F_status_set_error(F_parameter); + if (!variable) return F_status_set_error(F_parameter); + if (!vocabulary) return F_status_set_error(F_parameter); + if (!content) return F_status_set_error(F_parameter); if (range->start > range->stop) return F_status_set_error(F_parameter); if (range->start >= buffer->used) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ diff --git a/level_0/f_memory/c/memory-structure.h b/level_0/f_memory/c/memory-structure.h index 700a8f6..1f96b2a 100644 --- a/level_0/f_memory/c/memory-structure.h +++ b/level_0/f_memory/c/memory-structure.h @@ -234,7 +234,7 @@ extern "C" { structures.used--; \ f_macro_memory_structure_t_delete_simple(structures.array[structures.used], type_structure); \ } \ - if (structures.used == 0) { \ + if (!structures.used) { \ if (f_memory_delete((void **) & structures.array, sizeof(type_structures), structures.size)) { \ structures.size = 0; \ } \ @@ -255,7 +255,7 @@ extern "C" { structures.used--; \ f_macro_memory_structure_t_destroy_simple(structures.array[structures.used], type_structure); \ } \ - if (structures.used == 0) { \ + if (!structures.used) { \ if (f_memory_destroy((void **) & structures.array, sizeof(type_structures), structures.size)) { \ structures.size = 0; \ } \ diff --git a/level_0/f_memory/c/memory.c b/level_0/f_memory/c/memory.c index 078acde..685f3ad 100644 --- a/level_0/f_memory/c/memory.c +++ b/level_0/f_memory/c/memory.c @@ -8,7 +8,7 @@ extern "C" { f_return_status f_memory_new(void **pointer, const f_memory_size_t type, const f_memory_length length) { #ifndef _di_level_0_parameter_checking_ if (type <= 0) return F_status_set_error(F_parameter); - if (pointer == 0) return F_status_set_error(F_parameter); + if (!pointer) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ // prevent double-allocations. @@ -29,11 +29,11 @@ extern "C" { #if ! ( defined (_di_f_memory_delete_) || defined (_f_memory_FORCE_secure_memory_) ) f_return_status f_memory_delete(void **pointer, const f_memory_size_t type, const f_memory_length length) { #ifndef _di_level_0_parameter_checking_ - if (pointer == 0) return F_status_set_error(F_parameter); + if (!pointer) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ // prevent double-frees. - if (*pointer == 0) return F_none; + if (!*pointer) return F_none; free(*pointer); @@ -49,11 +49,11 @@ extern "C" { #ifndef _di_level_0_parameter_checking_ if (length < 0) return F_status_set_error(F_parameter); if (type <= 0) return F_status_set_error(F_parameter); - if (pointer == 0) return F_status_set_error(F_parameter); + if (!pointer) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ // prevent double-frees. - if (*pointer == 0) return F_none; + if (!*pointer) return F_none; if (length > 0) { memset(*pointer, 0, type * length); @@ -74,7 +74,7 @@ extern "C" { if (type <= 0) return F_status_set_error(F_parameter); if (old_length < 0) return F_status_set_error(F_parameter); if (new_length < 0) return F_status_set_error(F_parameter); - if (pointer == 0) return F_status_set_error(F_parameter); + if (!pointer) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ // don't be wasteful. @@ -131,7 +131,7 @@ extern "C" { if (type <= 0) return F_status_set_error(F_parameter); if (old_length < 0) return F_status_set_error(F_parameter); if (new_length < 0) return F_status_set_error(F_parameter); - if (pointer == 0) return F_status_set_error(F_parameter); + if (!pointer) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ // don't be wasteful diff --git a/level_0/f_path/c/path.c b/level_0/f_path/c/path.c index 45dd030..f93c5e9 100644 --- a/level_0/f_path/c/path.c +++ b/level_0/f_path/c/path.c @@ -52,7 +52,7 @@ extern "C" { #ifndef _di_f_path_current_ f_return_status f_path_current(const bool real, f_string_dynamic_t *path) { #ifndef _di_level_0_parameter_checking_ - if (path == 0) return F_status_set_error(F_parameter); + if (!path) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ char buffer[f_path_max]; diff --git a/level_0/f_print/c/print.c b/level_0/f_print/c/print.c index 193b4d7..8488538 100644 --- a/level_0/f_print/c/print.c +++ b/level_0/f_print/c/print.c @@ -8,8 +8,8 @@ extern "C" { #ifndef _di_f_print_ f_return_status f_print(FILE *output, const f_string_t string, const f_string_length_t length) { #ifndef _di_level_0_parameter_checking_ - if (output == 0) return F_status_set_error(F_parameter); - if (string == 0) return F_status_set_error(F_parameter); + if (!output) return F_status_set_error(F_parameter); + if (!string) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ return private_f_print(output, string, length); @@ -19,7 +19,7 @@ extern "C" { #ifndef _di_f_print_dynamic_ f_return_status f_print_dynamic(FILE *output, const f_string_static_t buffer) { #ifndef _di_level_0_parameter_checking_ - if (output == 0) return F_status_set_error(F_parameter); + if (!output) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ return private_f_print(output, buffer.string, buffer.used); @@ -29,7 +29,7 @@ extern "C" { #ifndef _di_f_print_dynamic_partial_ f_return_status f_print_dynamic_partial(FILE *output, const f_string_static_t buffer, const f_string_range_t range) { #ifndef _di_level_0_parameter_checking_ - if (output == 0) return F_status_set_error(F_parameter); + if (!output) return F_status_set_error(F_parameter); if (range.start < 0) return F_status_set_error(F_parameter); if (range.start > range.stop) return F_status_set_error(F_parameter); if (range.start >= buffer.used) return F_status_set_error(F_parameter); @@ -45,7 +45,7 @@ extern "C" { #ifndef _di_f_print_to_ f_return_status f_print_to(const int id, const f_string_t string, const f_string_length_t length) { #ifndef _di_level_0_parameter_checking_ - if (string == 0) return F_status_set_error(F_parameter); + if (!string) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ return private_f_print_to(id, string, length); diff --git a/level_0/f_print/c/private-print.c b/level_0/f_print/c/private-print.c index 48bca63..e9d0f0d 100644 --- a/level_0/f_print/c/private-print.c +++ b/level_0/f_print/c/private-print.c @@ -8,7 +8,7 @@ extern "C" { #if !defined(_di_f_print_) || !defined(_di_f_print_dynamic_) || !defined(_di_f_print_dynamic_partial_) f_return_status private_f_print(FILE *output, const f_string_t string, const f_string_length_t length) { - if (length == 0) return F_data_not; + if (!length) return F_data_not; for (register f_string_length_t i = 0; i < length; ++i) { if (!string[i]) continue; @@ -25,7 +25,7 @@ extern "C" { #if !defined(_di_f_print_to_) || !defined(_di_f_print_dynamic_to_) || !defined(_di_f_print_dynamic_partial_to_) f_return_status private_f_print_to(const int id, const f_string_t string, const f_string_length_t length) { - if (length == 0) return F_data_not; + if (!length) return F_data_not; for (register f_string_length_t i = 0; i < length; ++i) { if (!string[i]) continue; diff --git a/level_0/f_serialize/c/serialize.c b/level_0/f_serialize/c/serialize.c index e735f5f..325b72a 100644 --- a/level_0/f_serialize/c/serialize.c +++ b/level_0/f_serialize/c/serialize.c @@ -8,7 +8,7 @@ extern "C" { #ifndef _di_f_serialize_simple_ f_return_status f_serialize_simple(const f_string_static_t value, f_string_dynamic_t *serialize) { #ifndef _di_level_0_parameter_checking_ - if (serialize == 0) return F_status_set_error(F_parameter); + if (!serialize) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ f_status_t status = F_none; @@ -18,7 +18,7 @@ extern "C" { if (F_status_is_error(status)) return status; } - if (serialize->used == 0) { + if (!serialize->used) { memcpy(serialize->string + serialize->used, value.string, value.used); serialize->used += value.used; } @@ -35,8 +35,8 @@ extern "C" { #ifndef _di_f_serialize_un_simple_ f_return_status f_serialize_un_simple(const f_string_static_t serialize, f_string_dynamics_t *strings) { #ifndef _di_level_0_parameter_checking_ - if (serialize.used == 0) return F_status_set_error(F_parameter); - if (strings == 0) return F_status_set_error(F_parameter); + if (!serialize.used) return F_status_set_error(F_parameter); + if (!strings) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ f_status_t status = F_none; @@ -101,8 +101,8 @@ extern "C" { #ifndef _di_f_serialize_un_simple_map_ f_return_status f_serialize_un_simple_map(const f_string_static_t serialize, f_string_ranges_t *locations) { #ifndef _di_level_0_parameter_checking_ - if (serialize.used == 0) return F_status_set_error(F_parameter); - if (locations == 0) return F_status_set_error(F_parameter); + if (!serialize.used) return F_status_set_error(F_parameter); + if (!locations) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ f_status_t status = F_none; @@ -154,8 +154,8 @@ extern "C" { #ifndef _di_f_serialize_un_simple_find_ f_return_status f_serialize_un_simple_find(const f_string_static_t serialize, const f_array_length_t index, f_string_range_t *range) { #ifndef _di_level_0_parameter_checking_ - if (serialize.used == 0) return F_status_set_error(F_parameter); - if (range == 0) return F_status_set_error(F_parameter); + if (!serialize.used) return F_status_set_error(F_parameter); + if (!range) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ return private_f_serialize_un_simple_find(serialize, index, range); @@ -165,8 +165,8 @@ extern "C" { #ifndef _di_f_serialize_un_simple_get_ f_return_status f_serialize_un_simple_get(const f_string_static_t serialize, const f_array_length_t index, f_string_dynamic_t *dynamic) { #ifndef _di_level_0_parameter_checking_ - if (serialize.used == 0) return F_status_set_error(F_parameter); - if (dynamic == 0) return F_status_set_error(F_parameter); + if (!serialize.used) return F_status_set_error(F_parameter); + if (!dynamic) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ f_string_range_t range = f_string_range_t_initialize; diff --git a/level_0/f_string/c/string_dynamic.h b/level_0/f_string/c/string_dynamic.h index a3be8f3..a84ad58 100644 --- a/level_0/f_string/c/string_dynamic.h +++ b/level_0/f_string/c/string_dynamic.h @@ -183,7 +183,7 @@ extern "C" { while (dynamics.used > 0) { \ dynamics.used--; \ f_macro_string_dynamic_t_delete_simple(dynamics.array[dynamics.used]); \ - if (dynamics.used == 0) { \ + if (!dynamics.used) { \ if (f_memory_delete((void **) & dynamics.array, sizeof(f_string_dynamic_t), dynamics.size)) { \ dynamics.size = 0; \ } \ @@ -195,7 +195,7 @@ extern "C" { while (dynamics.used > 0) { \ dynamics.used--; \ f_macro_string_dynamic_t_destroy_simple(dynamics.array[dynamics.used]); \ - if (dynamics.used == 0) { \ + if (!dynamics.used) { \ if (f_memory_destroy((void **) & dynamics.array, sizeof(f_string_dynamic_t), dynamics.size)) { \ dynamics.size = 0; \ } \ diff --git a/level_0/f_string/c/string_map.h b/level_0/f_string/c/string_map.h index b7c4e31..7b8dd99 100644 --- a/level_0/f_string/c/string_map.h +++ b/level_0/f_string/c/string_map.h @@ -113,7 +113,7 @@ extern "C" { while (maps.used > 0) { \ maps.used--; \ f_macro_string_map_t_delete_simple(maps.array[maps.used]); \ - if (maps.used == 0) { \ + if (!maps.used) { \ if (f_memory_delete((void **) & maps.array, sizeof(f_string_map_t), maps.size)) { \ maps.size = 0; \ } \ @@ -125,7 +125,7 @@ extern "C" { while (maps.used > 0) { \ maps.used--; \ f_macro_string_map_t_destroy_simple(maps.array[maps.used]); \ - if (maps.used == 0) { \ + if (!maps.used) { \ if (f_memory_destroy((void **) & maps.array, sizeof(f_string_map_t), maps.size)) { \ maps.size = 0; \ } \ @@ -264,7 +264,7 @@ extern "C" { while (maps.used > 0) { \ maps.used--; \ f_macro_string_map_multi_t_delete_simple(maps.array[maps.used]); \ - if (maps.used == 0) { \ + if (!maps.used) { \ if (f_memory_delete((void **) & maps.array, sizeof(f_string_map_multi_t), maps.size)) { \ maps.size = 0; \ } \ @@ -276,7 +276,7 @@ extern "C" { while (maps.used > 0) { \ maps.used--; \ f_macro_string_map_multi_t_destroy_simple(maps.array[maps.used]); \ - if (maps.used == 0) { \ + if (!maps.used) { \ if (f_memory_destroy((void **) & maps.array, sizeof(f_string_map_multi_t), maps.size)) { \ maps.size = 0; \ } \ diff --git a/level_0/f_utf/c/private-utf.c b/level_0/f_utf/c/private-utf.c index 87425ba..5366791 100644 --- a/level_0/f_utf/c/private-utf.c +++ b/level_0/f_utf/c/private-utf.c @@ -145,7 +145,7 @@ extern "C" { #if !defined(_di_f_utf_character_is_ascii_) || !defined(_di_f_utf_is_ascii_) f_return_status private_f_utf_character_is_ascii(const f_utf_character_t character, const uint8_t width) { - if (width == 0) { + if (!width) { const uint8_t byte_first = f_macro_utf_character_t_to_char_1(character); if (byte_first >= 0x00 && byte_first <= 0x7f) { @@ -1936,7 +1936,7 @@ extern "C" { // reduce the number of checks by grouping checks by byte. const uint8_t byte_first = f_macro_utf_character_t_to_char_1(character); - if (width == 0) { + if (!width) { if (byte_first >= 0x00 && byte_first <= 0x7f) { return F_true; } diff --git a/level_0/f_utf/c/utf-common.h b/level_0/f_utf/c/utf-common.h index 8788a63..2e58e55 100644 --- a/level_0/f_utf/c/utf-common.h +++ b/level_0/f_utf/c/utf-common.h @@ -425,7 +425,7 @@ extern "C" { while (dynamics.used > 0) { \ dynamics.used--; \ f_macro_string_dynamic_t_delete_simple(dynamics.array[dynamics.used]); \ - if (dynamics.used == 0) { \ + if (!dynamics.used) { \ if (f_memory_delete((void **) & dynamics.array, sizeof(f_utf_string_dynamic_t), dynamics.size)) { \ dynamics.size = 0; \ } \ @@ -437,7 +437,7 @@ extern "C" { while (dynamics.used > 0) { \ dynamics.used--; \ f_macro_string_dynamic_t_destroy_simple(dynamics.array[dynamics.used]); \ - if (dynamics.used == 0) { \ + if (!dynamics.used) { \ if (f_memory_destroy((void **) & dynamics.array, sizeof(f_utf_string_dynamic_t), dynamics.size)) { \ dynamics.size = 0; \ } \ diff --git a/level_0/f_utf/c/utf.c b/level_0/f_utf/c/utf.c index 9e83ad6..3f03cf8 100644 --- a/level_0/f_utf/c/utf.c +++ b/level_0/f_utf/c/utf.c @@ -8,13 +8,13 @@ extern "C" { #ifndef _di_f_utf_buffer_decrement_ f_return_status f_utf_buffer_decrement(const f_string_static_t buffer, f_string_range_t *range, const f_string_length_t step) { #ifndef _di_level_0_parameter_checking_ - if (range == 0) return F_status_set_error(F_parameter); + if (!range) return F_status_set_error(F_parameter); if (range->start > range->stop) return F_status_set_error(F_parameter); if (range->start >= buffer.used) return F_status_set_error(F_parameter); if (step < 1) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (buffer.used == 0) return F_data_not; + if (!buffer.used) return F_data_not; f_string_length_t i = 0; uint8_t width = 0; @@ -41,13 +41,13 @@ extern "C" { #ifndef _di_f_utf_buffer_increment_ f_return_status f_utf_buffer_increment(const f_string_static_t buffer, f_string_range_t *range, const f_string_length_t step) { #ifndef _di_level_0_parameter_checking_ - if (range == 0) return F_status_set_error(F_parameter); + if (!range) return F_status_set_error(F_parameter); if (range->start > range->stop) return F_status_set_error(F_parameter); if (range->start >= buffer.used) return F_status_set_error(F_parameter); if (step < 1) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (buffer.used == 0) return F_data_not; + if (!buffer.used) return F_data_not; f_string_length_t i = 0; uint8_t width = 0; @@ -84,7 +84,7 @@ extern "C" { f_return_status f_utf_character_is(const f_utf_character_t character) { const uint8_t width = f_macro_utf_character_t_width_is(character); - if (width == 0) { + if (!width) { return F_false; } @@ -100,7 +100,7 @@ extern "C" { f_return_status f_utf_character_is_alpha(const f_utf_character_t character) { const uint8_t width = f_macro_utf_character_t_width_is(character); - if (width == 0) { + if (!width) { if (isalpha(f_macro_utf_character_t_to_char_1(character))) { return F_true; } @@ -120,7 +120,7 @@ extern "C" { f_return_status f_utf_character_is_alpha_digit(const f_utf_character_t character) { const uint8_t width = f_macro_utf_character_t_width_is(character); - if (width == 0) { + if (!width) { if (isalnum(f_macro_utf_character_t_to_char_1(character))) { return F_true; } @@ -140,7 +140,7 @@ extern "C" { f_return_status f_utf_character_is_alpha_numeric(const f_utf_character_t character) { const uint8_t width = f_macro_utf_character_t_width_is(character); - if (width == 0) { + if (!width) { if (isalnum(f_macro_utf_character_t_to_char_1(character))) { return F_true; } @@ -172,7 +172,7 @@ extern "C" { f_return_status f_utf_character_is_combining(const f_utf_character_t character) { const uint8_t width = f_macro_utf_character_t_width_is(character); - if (width == 0) { + if (!width) { // There are no combining characters in ASCII. return F_false; } @@ -193,7 +193,7 @@ extern "C" { f_return_status f_utf_character_is_control(const f_utf_character_t character) { const uint8_t width = f_macro_utf_character_t_width_is(character); - if (width == 0) { + if (!width) { if (iscntrl(f_macro_utf_character_t_to_char_1(character))) { return F_true; } @@ -213,7 +213,7 @@ extern "C" { f_return_status f_utf_character_is_control_picture(const f_utf_character_t character) { const uint8_t width = f_macro_utf_character_t_width_is(character); - if (width == 0) { + if (!width) { // There are no control picture characters in ASCII. return F_false; @@ -235,7 +235,7 @@ extern "C" { f_return_status f_utf_character_is_digit(const f_utf_character_t character) { const uint8_t width = f_macro_utf_character_t_width_is(character); - if (width == 0) { + if (!width) { if (isdigit(f_macro_utf_character_t_to_char_1(character))) { return F_true; } @@ -255,7 +255,7 @@ extern "C" { f_return_status f_utf_character_is_emoji(const f_utf_character_t character) { const uint8_t width = f_macro_utf_character_t_width_is(character); - if (width == 0) { + if (!width) { if (isdigit(f_macro_utf_character_t_to_char_1(character))) { return F_true; } @@ -285,7 +285,7 @@ extern "C" { f_return_status f_utf_character_is_graph(const f_utf_character_t character) { const uint8_t width = f_macro_utf_character_t_width_is(character); - if (width == 0) { + if (!width) { if (isgraph(f_macro_utf_character_t_to_char_1(character))) { return F_true; } @@ -317,7 +317,7 @@ extern "C" { f_return_status f_utf_character_is_numeric(const f_utf_character_t character) { const uint8_t width = f_macro_utf_character_t_width_is(character); - if (width == 0) { + if (!width) { if (isdigit(f_macro_utf_character_t_to_char_1(character))) { return F_true; } @@ -337,7 +337,7 @@ extern "C" { f_return_status f_utf_character_is_phonetic(const f_utf_character_t character) { const uint8_t width = f_macro_utf_character_t_width_is(character); - if (width == 0) { + if (!width) { // There are no ASCII phonetic characters. return F_false; @@ -355,7 +355,7 @@ extern "C" { f_return_status f_utf_character_is_private(const f_utf_character_t character) { const uint8_t width = f_macro_utf_character_t_width_is(character); - if (width == 0) { + if (!width) { // There are no ASCII private characters. return F_false; @@ -373,7 +373,7 @@ extern "C" { f_return_status f_utf_character_is_punctuation(const f_utf_character_t character) { const uint8_t width = f_macro_utf_character_t_width_is(character); - if (width == 0) { + if (!width) { // ASCII: '!' to '#'. if (character > 0x20000000 && character < 0x24000000) { @@ -420,7 +420,7 @@ extern "C" { f_return_status f_utf_character_is_symbol(const f_utf_character_t character) { const uint8_t width = f_macro_utf_character_t_width_is(character); - if (width == 0) { + if (!width) { // ASCII: '$' or '+'. if (character == 0x24000000 || character == 0x2b000000) { @@ -452,7 +452,7 @@ extern "C" { f_return_status f_utf_character_is_unassigned(const f_utf_character_t character) { const uint8_t width = f_macro_utf_character_t_width_is(character); - if (width == 0 || width == 1) { + if (!width || width == 1) { return F_false; } @@ -476,7 +476,7 @@ extern "C" { f_return_status f_utf_character_is_whitespace(const f_utf_character_t character) { const uint8_t width = f_macro_utf_character_t_width_is(character); - if (width == 0) { + if (!width) { if (isspace(f_macro_utf_character_t_to_char_1(character))) { return F_true; } @@ -496,7 +496,7 @@ extern "C" { f_return_status f_utf_character_is_whitespace_modifier(const f_utf_character_t character) { const uint8_t width = f_macro_utf_character_t_width_is(character); - if (width == 0) { + if (!width) { // There are no ASCII whitespace modifiers. return F_false; } @@ -513,7 +513,7 @@ extern "C" { f_return_status f_utf_character_is_whitespace_other(const f_utf_character_t character) { const uint8_t width = f_macro_utf_character_t_width_is(character); - if (width == 0) { + if (!width) { // There are no ASCII whitespace other. return F_false; @@ -531,7 +531,7 @@ extern "C" { f_return_status f_utf_character_is_word(const f_utf_character_t character, const bool strict) { const uint8_t width = f_macro_utf_character_t_width_is(character); - if (width == 0) { + if (!width) { if (isalnum(f_macro_utf_character_t_to_char_1(character)) || character == '_') { return F_true; } @@ -551,7 +551,7 @@ extern "C" { f_return_status f_utf_character_is_word_dash(const f_utf_character_t character, const bool strict) { const uint8_t width = f_macro_utf_character_t_width_is(character); - if (width == 0) { + if (!width) { if (isalnum(f_macro_utf_character_t_to_char_1(character)) || character == '_' || character == '-') { return F_true; } @@ -571,7 +571,7 @@ extern "C" { f_return_status f_utf_character_is_word_dash_plus(const f_utf_character_t character, const bool strict) { const uint8_t width = f_macro_utf_character_t_width_is(character); - if (width == 0) { + if (!width) { if (isalnum(f_macro_utf_character_t_to_char_1(character)) || character == '_' || character == '-' || character == '+') { return F_true; } @@ -591,7 +591,7 @@ extern "C" { f_return_status f_utf_character_is_zero_width(const f_utf_character_t character) { const uint8_t width = f_macro_utf_character_t_width_is(character); - if (width == 0) { + if (!width) { const uint8_t ascii = f_macro_utf_character_t_to_char_1(character); // These control characters are considered zero-width spaces. @@ -622,17 +622,17 @@ extern "C" { #ifndef _di_f_utf_character_to_char_ f_return_status f_utf_character_to_char(const f_utf_character_t utf_character, f_string_t *character, f_string_length_t *width_max) { #ifndef _di_level_0_parameter_checking_ - if (utf_character == 0) return F_status_set_error(F_parameter); - if (width_max == 0 && *character != 0) return F_status_set_error(F_parameter); - if (width_max != 0 && *character == 0) return F_status_set_error(F_parameter); - if (width_max != 0 && *width_max > 4) return F_status_set_error(F_parameter); + if (!utf_character) return F_status_set_error(F_parameter); + if (!width_max && *character) return F_status_set_error(F_parameter); + if (width_max && !*character) return F_status_set_error(F_parameter); + if (width_max && *width_max > 4) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ f_status_t status = F_none; uint8_t width = f_macro_utf_character_t_width_is(utf_character); - if (width_max == 0) { + if (!width_max) { f_macro_string_t_new(status, *character, width); if (F_status_is_error(status)) return status; @@ -696,7 +696,7 @@ extern "C" { const uint8_t width = f_macro_utf_byte_width_is(*character); - if (width == 0) { + if (!width) { return F_false; } @@ -716,7 +716,7 @@ extern "C" { const uint8_t width = f_macro_utf_byte_width_is(*character); - if (width == 0) { + if (!width) { if (isalpha(*character)) { return F_true; } @@ -750,7 +750,7 @@ extern "C" { const uint8_t width = f_macro_utf_byte_width_is(*character); - if (width == 0) { + if (!width) { if (isalnum(*character)) { return F_true; } @@ -784,7 +784,7 @@ extern "C" { const uint8_t width = f_macro_utf_byte_width_is(*character); - if (width == 0) { + if (!width) { if (isalnum(*character)) { return F_true; } @@ -845,7 +845,7 @@ extern "C" { const uint8_t width = f_macro_utf_byte_width_is(*character); // There are no ASCII combining characters. - if (width == 0) { + if (!width) { return F_false; } @@ -875,7 +875,7 @@ extern "C" { const uint8_t width = f_macro_utf_byte_width_is(*character); - if (width == 0) { + if (!width) { if (iscntrl(*character)) { return F_true; } @@ -910,7 +910,7 @@ extern "C" { const uint8_t width = f_macro_utf_byte_width_is(*character); // There are no ASCII control pictures. - if (width == 0) { + if (!width) { return F_false; } @@ -940,7 +940,7 @@ extern "C" { const uint8_t width = f_macro_utf_byte_width_is(*character); - if (width == 0) { + if (!width) { if (isdigit(*character)) { return F_true; } @@ -974,7 +974,7 @@ extern "C" { const uint8_t width = f_macro_utf_byte_width_is(*character); - if (width == 0) { + if (!width) { if (isdigit(*character)) { return F_true; } @@ -1024,7 +1024,7 @@ extern "C" { const uint8_t width = f_macro_utf_byte_width_is(*character); - if (width == 0) { + if (!width) { if (isgraph(*character)) { return F_true; } @@ -1071,7 +1071,7 @@ extern "C" { const uint8_t width = f_macro_utf_byte_width_is(*character); - if (width == 0) { + if (!width) { if (isdigit(*character)) { return F_true; } @@ -1105,7 +1105,7 @@ extern "C" { const uint8_t width = f_macro_utf_byte_width_is(*character); - if (width == 0) { + if (!width) { // There are no ASCII phonetic characters. return F_false; } @@ -1136,7 +1136,7 @@ extern "C" { const uint8_t width = f_macro_utf_byte_width_is(*character); - if (width == 0) { + if (!width) { // There are no ASCII private characters. return F_false; } @@ -1167,7 +1167,7 @@ extern "C" { const uint8_t width = f_macro_utf_byte_width_is(*character); - if (width == 0) { + if (!width) { // ASCII: '!' to '#'. if (character[0] > 0x20 && character[0] < 0x24) { @@ -1228,7 +1228,7 @@ extern "C" { const uint8_t width = f_macro_utf_byte_width_is(*character); - if (width == 0) { + if (!width) { // ASCII: '$' or '+'. if (character[0] == 0x24 || character[0] == 0x2b) { @@ -1274,7 +1274,7 @@ extern "C" { const uint8_t width = f_macro_utf_byte_width_is(*character); - if (width == 0 || width == 1) { + if (!width || width == 1) { return F_false; } @@ -1326,7 +1326,7 @@ extern "C" { const uint8_t width = f_macro_utf_byte_width_is(*character); - if (width == 0) { + if (!width) { if (isspace(*character)) { return F_true; } @@ -1360,7 +1360,7 @@ extern "C" { const uint8_t width = f_macro_utf_byte_width_is(*character); - if (width == 0) { + if (!width) { // There are no ASCII whitespace modifiers. return F_false; @@ -1392,7 +1392,7 @@ extern "C" { const uint8_t width = f_macro_utf_byte_width_is(*character); - if (width == 0) { + if (!width) { // There are no ASCII whitespace other. return F_false; @@ -1424,7 +1424,7 @@ extern "C" { const uint8_t width = f_macro_utf_byte_width_is(*character); - if (width == 0) { + if (!width) { if (isalnum(*character) || *character == '_') { return F_true; } @@ -1458,7 +1458,7 @@ extern "C" { const uint8_t width = f_macro_utf_byte_width_is(*character); - if (width == 0) { + if (!width) { if (isalnum(*character) || *character == '_' || *character == '-') { return F_true; } @@ -1492,7 +1492,7 @@ extern "C" { const uint8_t width = f_macro_utf_byte_width_is(*character); - if (width == 0) { + if (!width) { if (isalnum(*character) || *character == '_' || *character == '-' || *character == '+') { return F_true; } @@ -1526,7 +1526,7 @@ extern "C" { const uint8_t width = f_macro_utf_byte_width_is(*character); - if (width == 0) { + if (!width) { // These control characters are considered zero-width spaces. if (*character >= 0x00 && *character <= 0x08) { @@ -1564,12 +1564,12 @@ extern "C" { f_return_status f_utf_char_to_character(const f_string_t character, const f_string_length_t width_max, f_utf_character_t *character_utf) { #ifndef _di_level_0_parameter_checking_ if (width_max < 1) return F_status_set_error(F_parameter); - if (character_utf == 0) return F_status_set_error(F_parameter); + if (!character_utf) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ const uint8_t width = f_macro_utf_byte_width_is(*character); - if (width == 0) { + if (!width) { *character_utf = f_macro_utf_character_t_from_char_1(character[0]); return F_none; } diff --git a/level_1/fl_color/c/color.c b/level_1/fl_color/c/color.c index 2c4498c..0184d95 100644 --- a/level_1/fl_color/c/color.c +++ b/level_1/fl_color/c/color.c @@ -7,19 +7,19 @@ extern "C" { #ifndef _di_fl_color_set_ f_return_status fl_color_set(FILE *file, const f_color_format_t format, const int8_t *color1, const int8_t *color2, const int8_t *color3, const int8_t *color4, const int8_t *color5) { #ifndef _di_level_1_parameter_checking_ - if (file == 0) return F_status_set_error(F_parameter); - if (color1 == 0) return F_status_set_error(F_parameter); + if (!file) return F_status_set_error(F_parameter); + if (!color1) return F_status_set_error(F_parameter); // make sure all data is in the proper order - if (color2 == 0 && (color3 != 0 || color4 != 0 || color5 != 0)) return F_status_set_error(F_parameter); - if (color3 == 0 && (color4 != 0 || color5 != 0)) return F_status_set_error(F_parameter); - if (color4 == 0 && color5 != 0) return F_status_set_error(F_parameter); + if (!color2 && (color3 != 0 || color4 != 0 || color5 != 0)) return F_status_set_error(F_parameter); + if (!color3 && (color4 != 0 || color5 != 0)) return F_status_set_error(F_parameter); + if (!color4 && color5 != 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (color2 == 0) fprintf(file, "%s%s%s", format.begin, color1, format.end); - else if (color3 == 0) fprintf(file, "%s%s%s%s%s", format.begin, color1, format.medium, color2, format.end); - else if (color4 == 0) fprintf(file, "%s%s%s%s%s%s%s", format.begin, color1, format.medium, color2, format.medium, color3, format.end); - else if (color5 == 0) fprintf(file, "%s%s%s%s%s%s%s%s%s", format.begin, color1, format.medium, color2, format.medium, color3, format.medium, color4, format.end); + if (!color2) fprintf(file, "%s%s%s", format.begin, color1, format.end); + else if (!color3) fprintf(file, "%s%s%s%s%s", format.begin, color1, format.medium, color2, format.end); + else if (!color4) fprintf(file, "%s%s%s%s%s%s%s", format.begin, color1, format.medium, color2, format.medium, color3, format.end); + else if (!color5) fprintf(file, "%s%s%s%s%s%s%s%s%s", format.begin, color1, format.medium, color2, format.medium, color3, format.medium, color4, format.end); else fprintf(file, "%s%s%s%s%s%s%s%s%s%s%s", format.begin, color1, format.medium, color2, format.medium, color3, format.medium, color4, format.medium, color5, format.end); return F_none; @@ -29,21 +29,21 @@ extern "C" { #ifndef _di_fl_color_save_ f_return_status fl_color_save(f_string_dynamic_t *buffer, const f_color_format_t format, const int8_t *color1, const int8_t *color2, const int8_t *color3, const int8_t *color4, const int8_t *color5) { #ifndef _di_level_1_parameter_checking_ - if (buffer == 0) return F_status_set_error(F_parameter); - if (color1 == 0) return F_status_set_error(F_parameter); + if (!buffer) return F_status_set_error(F_parameter); + if (!color1) return F_status_set_error(F_parameter); // make sure all data is in the proper order - if (color2 == 0 && (color3 != 0 || color4 != 0 || color5 != 0)) return F_status_set_error(F_parameter); - if (color3 == 0 && (color4 != 0 || color5 != 0)) return F_status_set_error(F_parameter); - if (color4 == 0 && color5 != 0) return F_status_set_error(F_parameter); + if (!color2 && (color3 != 0 || color4 != 0 || color5 != 0)) return F_status_set_error(F_parameter); + if (!color3 && (color4 != 0 || color5 != 0)) return F_status_set_error(F_parameter); + if (!color4 && color5 != 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ f_string_length_t string_size = strnlen(format.begin, f_color_max_size) + strnlen(format.end, f_color_max_size) + 1; - if (color2 == 0) string_size += strnlen(color1, f_color_max_size); - else if (color3 == 0) string_size += strnlen(color1, f_color_max_size) + strnlen(color2, f_color_max_size); - else if (color4 == 0) string_size += strnlen(color1, f_color_max_size) + strnlen(color2, f_color_max_size) + strnlen(color3, f_color_max_size); - else if (color5 == 0) string_size += strnlen(color1, f_color_max_size) + strnlen(color2, f_color_max_size) + strnlen(color3, f_color_max_size) + strnlen(color4, f_color_max_size); + if (!color2) string_size += strnlen(color1, f_color_max_size); + else if (!color3) string_size += strnlen(color1, f_color_max_size) + strnlen(color2, f_color_max_size); + else if (!color4) string_size += strnlen(color1, f_color_max_size) + strnlen(color2, f_color_max_size) + strnlen(color3, f_color_max_size); + else if (!color5) string_size += strnlen(color1, f_color_max_size) + strnlen(color2, f_color_max_size) + strnlen(color3, f_color_max_size) + strnlen(color4, f_color_max_size); else string_size += strnlen(color1, f_color_max_size) + strnlen(color2, f_color_max_size) + strnlen(color3, f_color_max_size) + strnlen(color4, f_color_max_size) + strnlen(color5, f_color_max_size); // make sure there is enough allocated space, if not, then allocate some more @@ -57,19 +57,19 @@ extern "C" { } } - if (color2 == 0) { + if (!color2) { strncat(buffer->string, format.begin, f_color_max_size); strncat(buffer->string, color1, f_color_max_size); strncat(buffer->string, format.end, f_color_max_size); } - else if (color3 == 0) { + else if (!color3) { strncat(buffer->string, format.begin, f_color_max_size); strncat(buffer->string, color1, f_color_max_size); strncat(buffer->string, format.medium, f_color_max_size); strncat(buffer->string, color2, f_color_max_size); strncat(buffer->string, format.end, f_color_max_size); } - else if (color4 == 0) { + else if (!color4) { strncat(buffer->string, format.begin, f_color_max_size); strncat(buffer->string, color1, f_color_max_size); strncat(buffer->string, format.medium, f_color_max_size); @@ -78,7 +78,7 @@ extern "C" { strncat(buffer->string, color3, f_color_max_size); strncat(buffer->string, format.end, f_color_max_size); } - else if (color5 == 0) { + else if (!color5) { strncat(buffer->string, format.begin, f_color_max_size); strncat(buffer->string, color1, f_color_max_size); strncat(buffer->string, format.medium, f_color_max_size); @@ -116,8 +116,8 @@ extern "C" { #ifndef _di_fl_color_print_ f_return_status fl_color_print(FILE *file, const f_color_set_t set, const f_string_t string, ...) { #ifndef _di_level_1_parameter_checking_ - if (file == 0) return F_status_set_error(F_parameter); - if (string == 0) return F_status_set_error(F_parameter); + if (!file) return F_status_set_error(F_parameter); + if (!string) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ if (set.before) { @@ -146,8 +146,8 @@ extern "C" { #ifndef _di_fl_color_print2_ f_return_status fl_color_print2(FILE *file, const f_color_set_t set, const f_color_set_t extra, const f_string_t string, ...) { #ifndef _di_level_1_parameter_checking_ - if (file == 0) return F_status_set_error(F_parameter); - if (string == 0) return F_status_set_error(F_parameter); + if (!file) return F_status_set_error(F_parameter); + if (!string) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ f_status_t status = F_none; @@ -187,8 +187,8 @@ extern "C" { #ifndef _di_fl_color_print_line_ f_return_status fl_color_print_line(FILE *file, const f_color_set_t set, const f_string_t string, ...) { #ifndef _di_level_1_parameter_checking_ - if (file == 0) return F_status_set_error(F_parameter); - if (string == 0) return F_status_set_error(F_parameter); + if (!file) return F_status_set_error(F_parameter); + if (!string) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ if (set.before) { @@ -219,8 +219,8 @@ extern "C" { #ifndef _di_fl_color_print2_line_ f_return_status fl_color_print2_line(FILE *file, const f_color_set_t set, const f_color_set_t extra, const f_string_t string, ...) { #ifndef _di_level_1_parameter_checking_ - if (file == 0) return F_status_set_error(F_parameter); - if (string == 0) return F_status_set_error(F_parameter); + if (!file) return F_status_set_error(F_parameter); + if (!string) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ f_status_t status = F_none; @@ -274,7 +274,7 @@ extern "C" { #ifndef _di_fl_color_load_context_ f_return_status fl_color_load_context(f_color_context_t *context, const bool use_light_colors) { #ifndef _di_level_1_parameter_checking_ - if (context == 0) return F_status_set_error(F_parameter); + if (!context) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ f_status_t status = F_none; diff --git a/level_1/fl_console/c/console.c b/level_1/fl_console/c/console.c index 9b2a761..833c8be 100644 --- a/level_1/fl_console/c/console.c +++ b/level_1/fl_console/c/console.c @@ -7,13 +7,13 @@ extern "C" { #ifndef _fl_console_parameter_to_string_dynamic_directory_ f_return_status fl_console_parameter_to_string_dynamic_directory(const f_string_t argument, f_string_dynamic_t *directory) { #ifndef _di_level_1_parameter_checking_ - if (argument == 0) return F_status_set_error(F_parameter); + if (!argument) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ f_status_t status = F_none; f_string_length_t length = strlen(argument); - if (length == 0) { + if (!length) { directory->used = 0; return F_none; } diff --git a/level_1/fl_conversion/c/conversion.c b/level_1/fl_conversion/c/conversion.c index c0f635d..209ce0e 100644 --- a/level_1/fl_conversion/c/conversion.c +++ b/level_1/fl_conversion/c/conversion.c @@ -7,12 +7,12 @@ extern "C" { #ifndef _di_fl_conversion_string_to_binary_signed_ f_return_status fl_conversion_string_to_binary_signed(const f_string_t string, f_number_signed_t *number, const f_string_range_t range, const bool negative) { #ifndef _di_level_1_parameter_checking_ - if (string == 0) return F_status_set_error(F_parameter); - if (number == 0) return F_status_set_error(F_parameter); + if (!string) return F_status_set_error(F_parameter); + if (!number) return F_status_set_error(F_parameter); if (range.start > range.stop) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (string[0] == 0) { + if (!string[0]) { return F_data_not; } @@ -67,12 +67,12 @@ extern "C" { #ifndef _di_fl_conversion_string_to_binary_unsigned_ f_return_status fl_conversion_string_to_binary_unsigned(const f_string_t string, f_number_unsigned_t *number, const f_string_range_t range) { #ifndef _di_level_1_parameter_checking_ - if (string == 0) return F_status_set_error(F_parameter); - if (number == 0) return F_status_set_error(F_parameter); + if (!string) return F_status_set_error(F_parameter); + if (!number) return F_status_set_error(F_parameter); if (range.start > range.stop) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (string[0] == 0) { + if (!string[0]) { return F_data_not; } @@ -111,12 +111,12 @@ extern "C" { #ifndef _di_fl_conversion_string_to_decimal_signed_ f_return_status fl_conversion_string_to_decimal_signed(const f_string_t string, f_number_signed_t *number, const f_string_range_t range, const bool negative) { #ifndef _di_level_1_parameter_checking_ - if (string == 0) return F_status_set_error(F_parameter); - if (number == 0) return F_status_set_error(F_parameter); + if (!string) return F_status_set_error(F_parameter); + if (!number) return F_status_set_error(F_parameter); if (range.start > range.stop) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (string[0] == 0) { + if (!string[0]) { return F_data_not; } @@ -176,12 +176,12 @@ extern "C" { #ifndef _di_fl_conversion_string_to_decimal_unsigned_ f_return_status fl_conversion_string_to_decimal_unsigned(const f_string_t string, f_number_unsigned_t *number, const f_string_range_t range) { #ifndef _di_level_1_parameter_checking_ - if (string == 0) return F_status_set_error(F_parameter); - if (number == 0) return F_status_set_error(F_parameter); + if (!string) return F_status_set_error(F_parameter); + if (!number) return F_status_set_error(F_parameter); if (range.start > range.stop) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (string[0] == 0) { + if (!string[0]) { return F_data_not; } @@ -223,12 +223,12 @@ extern "C" { #ifndef _di_fl_conversion_string_to_duodecimal_signed_ f_return_status fl_conversion_string_to_duodecimal_signed(const f_string_t string, f_number_signed_t *number, const f_string_range_t range, const bool negative) { #ifndef _di_level_1_parameter_checking_ - if (string == 0) return F_status_set_error(F_parameter); - if (number == 0) return F_status_set_error(F_parameter); + if (!string) return F_status_set_error(F_parameter); + if (!number) return F_status_set_error(F_parameter); if (range.start > range.stop) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (string[0] == 0) { + if (!string[0]) { return F_data_not; } @@ -288,12 +288,12 @@ extern "C" { #ifndef _di_fl_conversion_string_to_duodecimal_unsigned_ f_return_status fl_conversion_string_to_duodecimal_unsigned(const f_string_t string, f_number_unsigned_t *number, const f_string_range_t range) { #ifndef _di_level_1_parameter_checking_ - if (string == 0) return F_status_set_error(F_parameter); - if (number == 0) return F_status_set_error(F_parameter); + if (!string) return F_status_set_error(F_parameter); + if (!number) return F_status_set_error(F_parameter); if (range.start > range.stop) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (string[0] == 0) { + if (!string[0]) { return F_data_not; } @@ -335,12 +335,12 @@ extern "C" { #ifndef _di_fl_conversion_string_to_hexidecimal_signed_ f_return_status fl_conversion_string_to_hexidecimal_signed(const f_string_t string, f_number_signed_t *number, const f_string_range_t range, const bool negative) { #ifndef _di_level_1_parameter_checking_ - if (string == 0) return F_status_set_error(F_parameter); - if (number == 0) return F_status_set_error(F_parameter); + if (!string) return F_status_set_error(F_parameter); + if (!number) return F_status_set_error(F_parameter); if (range.start > range.stop) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (string[0] == 0) { + if (!string[0]) { return F_data_not; } @@ -400,12 +400,12 @@ extern "C" { #ifndef _di_fl_conversion_string_to_hexidecimal_unsigned_ f_return_status fl_conversion_string_to_hexidecimal_unsigned(const f_string_t string, f_number_unsigned_t *number, const f_string_range_t range) { #ifndef _di_level_1_parameter_checking_ - if (string == 0) return F_status_set_error(F_parameter); - if (number == 0) return F_status_set_error(F_parameter); + if (!string) return F_status_set_error(F_parameter); + if (!number) return F_status_set_error(F_parameter); if (range.start > range.stop) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (string[0] == 0) { + if (!string[0]) { return F_data_not; } @@ -447,12 +447,12 @@ extern "C" { #ifndef _di_fl_conversion_string_to_octal_signed_ f_return_status fl_conversion_string_to_octal_signed(const f_string_t string, f_number_signed_t *number, const f_string_range_t range, const bool negative) { #ifndef _di_level_1_parameter_checking_ - if (string == 0) return F_status_set_error(F_parameter); - if (number == 0) return F_status_set_error(F_parameter); + if (!string) return F_status_set_error(F_parameter); + if (!number) return F_status_set_error(F_parameter); if (range.start > range.stop) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (string[0] == 0) { + if (!string[0]) { return F_data_not; } @@ -512,12 +512,12 @@ extern "C" { #ifndef _di_fl_conversion_string_to_octal_unsigned_ f_return_status fl_conversion_string_to_octal_unsigned(const f_string_t string, f_number_unsigned_t *number, const f_string_range_t range) { #ifndef _di_level_1_parameter_checking_ - if (string == 0) return F_status_set_error(F_parameter); - if (number == 0) return F_status_set_error(F_parameter); + if (!string) return F_status_set_error(F_parameter); + if (!number) return F_status_set_error(F_parameter); if (range.start > range.stop) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (string[0] == 0) { + if (!string[0]) { return F_data_not; } @@ -559,12 +559,12 @@ extern "C" { #ifndef _di_fl_conversion_string_to_number_signed_ f_return_status fl_conversion_string_to_number_signed(const f_string_t string, f_number_signed_t *number, const f_string_range_t range) { #ifndef _di_level_1_parameter_checking_ - if (string == 0) return F_status_set_error(F_parameter); - if (number == 0) return F_status_set_error(F_parameter); + if (!string) return F_status_set_error(F_parameter); + if (!number) return F_status_set_error(F_parameter); if (range.start > range.stop) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (string[0] == 0) { + if (!string[0]) { return F_data_not; } @@ -579,9 +579,9 @@ extern "C" { for (f_string_length_t i = range.start; i <= range.stop; i++) { width = f_macro_utf_byte_width_is(string[i]); - if (width == 0) { + if (!width) { if (isspace(string[i])) { - if (mode == 0 && vector == 0) { + if (!mode && !vector) { offset++; continue; } @@ -590,7 +590,7 @@ extern "C" { } } else { - if (mode == 0 && vector == 0) { + if (!mode && !vector) { width_max = (range.stop - i) + 1; status = f_utf_is_whitespace(string + i, width_max); @@ -648,7 +648,7 @@ extern "C" { // plus sign is only allowed as the first non-whitespace character. if (string[i] == 0x2b) { - if (mode == 0 && vector == 0) { + if (!mode && !vector) { vector = 1; offset++; } @@ -659,7 +659,7 @@ extern "C" { // negative sign is not allowed. if (string[i] == 0x2d) { - if (mode == 0 && vector == 0) { + if (!mode && !vector) { vector = -1; offset++; } @@ -676,7 +676,7 @@ extern "C" { return F_status_set_error(F_number); } // for - if (mode == 0) { + if (!mode) { return F_status_set_error(F_number); } @@ -711,12 +711,12 @@ extern "C" { #ifndef _di_fl_conversion_string_to_number_unsigned_ f_return_status fl_conversion_string_to_number_unsigned(const f_string_t string, f_number_unsigned_t *number, const f_string_range_t range) { #ifndef _di_level_1_parameter_checking_ - if (string == 0) return F_status_set_error(F_parameter); - if (number == 0) return F_status_set_error(F_parameter); + if (!string) return F_status_set_error(F_parameter); + if (!number) return F_status_set_error(F_parameter); if (range.start > range.stop) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (string[0] == 0) { + if (!string[0]) { return F_data_not; } @@ -731,9 +731,9 @@ extern "C" { for (f_string_length_t i = range.start; i <= range.stop; i++) { width = f_macro_utf_byte_width_is(string[i]); - if (width == 0) { + if (!width) { if (isspace(string[i])) { - if (mode == 0) { + if (!mode) { offset++; continue; } @@ -742,7 +742,7 @@ extern "C" { } } else { - if (mode == 0) { + if (!mode) { width_max = (range.stop - i) + 1; status = f_utf_is_whitespace(string + i, width_max); @@ -816,7 +816,7 @@ extern "C" { return F_status_set_error(F_number); } // for - if (mode == 0) { + if (!mode) { return F_status_set_error(F_number); } diff --git a/level_1/fl_directory/c/directory.c b/level_1/fl_directory/c/directory.c index da50aaa..c1ae6e2 100644 --- a/level_1/fl_directory/c/directory.c +++ b/level_1/fl_directory/c/directory.c @@ -54,7 +54,7 @@ extern "C" { for (; i > 0; i--, static_source.used--) { - if (source[i - 1] == 0) continue; + if (!source[i - 1]) continue; if (source[i - 1] == f_path_separator[0]) continue; break; @@ -64,7 +64,7 @@ extern "C" { for (; i > 0; i--, static_destination.used--) { - if (destination[i - 1] == 0) continue; + if (!destination[i - 1]) continue; if (destination[i - 1] == f_path_separator[0]) continue; break; @@ -108,7 +108,7 @@ extern "C" { for (; i > 0; i--, static_source.used--) { - if (source[i - 1] == 0) continue; + if (!source[i - 1]) continue; if (source[i - 1] == f_path_separator[0]) continue; break; @@ -118,20 +118,18 @@ extern "C" { for (; i > 0; i--, static_destination.used--) { - if (destination[i - 1] == 0) continue; + if (!destination[i - 1]) continue; if (destination[i - 1] == f_path_separator[0]) continue; break; } // for } - if (recurse.depth_max == 0) { + if (!recurse.depth_max) { return status; } - if (recurse.depth_max) { - status = private_fl_directory_clone(static_source, static_destination, role, recurse, 1); - } + status = private_fl_directory_clone(static_source, static_destination, role, recurse, 1); if (status == F_none && recurse.output && recurse.verbose) { recurse.verbose(recurse.output, source, destination); @@ -178,7 +176,7 @@ extern "C" { for (; i > 0; i--, static_source.used--) { - if (source[i - 1] == 0) continue; + if (!source[i - 1]) continue; if (source[i - 1] == f_path_separator[0]) continue; break; @@ -188,7 +186,7 @@ extern "C" { for (; i > 0; i--, static_destination.used--) { - if (destination[i - 1] == 0) continue; + if (!destination[i - 1]) continue; if (destination[i - 1] == f_path_separator[0]) continue; break; @@ -232,7 +230,7 @@ extern "C" { for (; i > 0; i--, static_source.used--) { - if (source[i - 1] == 0) continue; + if (!source[i - 1]) continue; if (source[i - 1] == f_path_separator[0]) continue; break; @@ -242,7 +240,7 @@ extern "C" { for (; i > 0; i--, static_destination.used--) { - if (destination[i - 1] == 0) continue; + if (!destination[i - 1]) continue; if (destination[i - 1] == f_path_separator[0]) continue; break; @@ -278,7 +276,7 @@ extern "C" { if (path->used > path->size) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (path->used == 0) { + if (!path->used) { return F_data_not; } @@ -292,7 +290,7 @@ extern "C" { for (; i > 0; i--) { - if (path->string[i] == 0) continue; + if (!path->string[i]) continue; status = f_utf_is_control(path->string + i, path->used - i); if (status == F_true) continue; @@ -320,7 +318,7 @@ extern "C" { first_nulless = F_true; for (j = i; j > 0; j--) { - if (path->string[j] == 0) continue; + if (!path->string[j]) continue; status = f_utf_is_control(path->string + j, path->used - j); if (status == F_true) continue; @@ -351,7 +349,7 @@ extern "C" { if (destination->used > destination->size) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (length == 0) { + if (!length) { return F_data_not; } @@ -366,7 +364,7 @@ extern "C" { if (destination->used > destination->size) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (source.used == 0) { + if (!source.used) { return F_data_not; } diff --git a/level_1/fl_directory/c/private-directory.c b/level_1/fl_directory/c/private-directory.c index 05916ab..07798d0 100644 --- a/level_1/fl_directory/c/private-directory.c +++ b/level_1/fl_directory/c/private-directory.c @@ -422,7 +422,7 @@ extern "C" { DIR *parent = opendir(path); - if (parent == 0) { + if (!parent) { if (errno == ENOMEM) { return F_status_set_error(F_memory_out); } @@ -483,7 +483,7 @@ extern "C" { size = strnlen(entity[i]->d_name, f_directory_name_max); // There is no reason to include "." and ".." in the directory listing. - if (strncmp(entity[i]->d_name, "..", 3) == 0 || strncmp(entity[i]->d_name, ".", 2) == 0) { + if (!strncmp(entity[i]->d_name, "..", 3) || !strncmp(entity[i]->d_name, ".", 2)) { f_memory_delete((void **) & entity[i], sizeof(char *), 1); continue; } @@ -562,7 +562,7 @@ extern "C" { f_memory_delete((void **) & entity, sizeof(struct dirent *), 1); if (F_status_is_error(status)) return status; - if (length == 0) return F_data_not; + if (!length) return F_data_not; return F_none; } @@ -584,7 +584,7 @@ extern "C" { f_string_length_t j = 0; if (destination->used > 0) { - if (destination->string[destination->used - 1] == 0) { + if (!destination->string[destination->used - 1]) { terminated_null = F_true; total = 1; @@ -592,7 +592,7 @@ extern "C" { } for (i = destination->used - 1; i > 0; i--) { - if (destination->string[i] == 0) continue; + if (!destination->string[i]) continue; status = f_utf_is_control(destination->string + i, destination->used - i); if (status == F_true) continue; @@ -606,7 +606,7 @@ extern "C" { if (destination->string[i] == f_path_separator[0]) { if (i - 1 > 0) { for (j = i - 1; j > 0; j--) { - if (destination->string[j] == 0) continue; + if (!destination->string[j]) continue; status = f_utf_is_control(destination->string + j, destination->used - j); if (status == F_true) continue; @@ -634,7 +634,7 @@ extern "C" { break; } // for - if (destination->used > 0 && i == 0) { + if (destination->used > 0 && !i) { if (destination->string[0] != 0 && destination->string[0] != f_path_separator[0]) { separator_prepend = F_true; total++; @@ -643,7 +643,7 @@ extern "C" { } for (i = length - 1; i > 0; i--) { - if (source[i] == 0) continue; + if (!source[i]) continue; status = f_utf_is_control(source + i, length - i); if (status == F_true) continue; @@ -661,7 +661,7 @@ extern "C" { if (i - 1 > 0) { for (j = i - 1; j > 0; j--) { - if (source[j] == 0) continue; + if (!source[j]) continue; status = f_utf_is_control(source + j, length - j); if (status == F_true) continue; @@ -689,13 +689,13 @@ extern "C" { break; } // for - if (i == 0 && source[0] != f_path_separator[0]) { + if (!i && source[0] != f_path_separator[0]) { separator_append = F_true; total++; } for (i = 0; i < length_truncated; i++) { - if (source[i] == 0) continue; + if (!source[i]) continue; status = f_utf_is_control(source + i, length - i); if (status == F_true) continue; @@ -711,7 +711,7 @@ extern "C" { if (source[0] == f_path_separator[0]) { if (i + 1 < length_truncated) { for (j = i + 1; j < length_truncated; j++) { - if (source[j] == 0) continue; + if (!source[j]) continue; status = f_utf_is_control(source + j, length - j); if (status == F_true) continue; diff --git a/level_1/fl_environment/c/environment.c b/level_1/fl_environment/c/environment.c index 59fa7d1..2053138 100644 --- a/level_1/fl_environment/c/environment.c +++ b/level_1/fl_environment/c/environment.c @@ -7,14 +7,14 @@ extern "C" { #ifndef _di_fl_environment_path_explode_ f_return_status fl_environment_path_explode(const f_string_t path, f_string_dynamics_t *paths) { #ifndef _di_level_0_parameter_checking_ - if (paths == 0) return F_status_set_error(F_parameter); + if (!paths) return F_status_set_error(F_parameter); if (paths->used > paths->size) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ f_status_t status = F_none; const f_string_length_t length = strnlen(path, PATH_MAX); - if (length == 0) { + if (!length) { // When PATH is "", this is actually a valid search path for PWD. // Append an equivalent representation of PWD (string used length is 0). @@ -37,7 +37,7 @@ extern "C" { f_macro_memory_structure_macro_increment(status, (*paths), 1, f_memory_default_allocation_step, f_macro_string_dynamics_resize, F_buffer_too_large); if (F_status_is_error(status)) return status; - if (i == 0) { + if (!i) { f_macro_string_dynamic_t_clear(paths->array[paths->used]); paths->used++; @@ -84,13 +84,13 @@ extern "C" { f_return_status fl_environment_path_explode_dynamic(const f_string_static_t path, f_string_dynamics_t *paths) { #ifndef _di_level_0_parameter_checking_ if (path.used > path.size) return F_status_set_error(F_parameter); - if (paths == 0) return F_status_set_error(F_parameter); + if (!paths) return F_status_set_error(F_parameter); if (paths->used > paths->size) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ f_status_t status = F_none; - if (path.used == 0) { + if (!path.used) { // When PATH is "", this is actually a valid search path for PWD. // Therefore append an equivalent representation of PWD (string used length is 0). @@ -116,7 +116,7 @@ extern "C" { f_macro_memory_structure_macro_increment(status, (*paths), 1, f_memory_default_allocation_step, f_macro_string_dynamics_resize, F_buffer_too_large); if (F_status_is_error(status)) return status; - if (i == 0) { + if (!i) { f_macro_string_dynamic_t_clear(paths->array[paths->used]); paths->used++; @@ -131,7 +131,7 @@ extern "C" { if (F_status_is_error(status)) return status; for (j = 0; j < total; j++) { - if (path.string[first + j] == 0) continue; + if (!path.string[first + j]) continue; part.string[part.used] = path.string[first + j]; part.used++; @@ -162,14 +162,14 @@ extern "C" { #ifndef _di_fl_environment_path_explode_reverse_ f_return_status fl_environment_path_explode_reverse(const f_string_t path, f_string_dynamics_t *paths) { #ifndef _di_level_0_parameter_checking_ - if (paths == 0) return F_status_set_error(F_parameter); + if (!paths) return F_status_set_error(F_parameter); if (paths->used > paths->size) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ f_status_t status = F_none; const f_string_length_t length = strnlen(path, PATH_MAX); - if (length == 0) { + if (!length) { // When PATH is "", this is actually a valid search path for PWD. // Therefore append an equivalent representation of PWD (string used length is 0). @@ -194,7 +194,7 @@ extern "C" { for (; i > 0; i--) { j--; - if (j == 0 || path[j] == f_path_separator_variable[0]) { + if (!j || path[j] == f_path_separator_variable[0]) { f_macro_memory_structure_macro_increment(status, (*paths), 1, f_memory_default_allocation_step, f_macro_string_dynamics_resize, F_buffer_too_large); if (F_status_is_error(status)) return status; @@ -221,7 +221,7 @@ extern "C" { last = j; } - else if (j == 0) { + else if (!j) { // when j = 0, the total is actually the entire length to max. total = last - j; @@ -260,13 +260,13 @@ extern "C" { f_return_status fl_environment_path_explode_reverse_dynamic(const f_string_static_t path, f_string_dynamics_t *paths) { #ifndef _di_level_0_parameter_checking_ if (path.used > path.size) return F_status_set_error(F_parameter); - if (paths == 0) return F_status_set_error(F_parameter); + if (!paths) return F_status_set_error(F_parameter); if (paths->used > paths->size) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ f_status_t status = F_none; - if (path.used == 0) { + if (!path.used) { // When PATH is "", this is actually a valid search path for PWD. // Therefore append an equivalent representation of PWD (string used length is 0). f_macro_memory_structure_macro_increment(status, (*paths), 1, f_memory_default_allocation_step, f_macro_string_dynamics_resize, F_buffer_too_large); @@ -289,7 +289,7 @@ extern "C" { for (; i > 0; i--) { j--; - if (j == 0 || path.string[j] == f_path_separator_variable[0]) { + if (!j || path.string[j] == f_path_separator_variable[0]) { f_macro_memory_structure_macro_increment(status, (*paths), 1, f_memory_default_allocation_step, f_macro_string_dynamics_resize, F_buffer_too_large); if (F_status_is_error(status)) return status; @@ -301,7 +301,7 @@ extern "C" { if (F_status_is_error(status)) return status; for (k = 0; k < total; k++) { - if (path.string[i + k] == 0) continue; + if (!path.string[i + k]) continue; part.string[part.used] = path.string[i + k]; part.used++; @@ -318,7 +318,7 @@ extern "C" { last = j; } - else if (j == 0) { + else if (!j) { // when j = 0, the total is actually the entire length to max. total = last - j; @@ -326,7 +326,7 @@ extern "C" { if (F_status_is_error(status)) return status; for (k = 0; k < total; k++) { - if (path.string[i + k] == 0) continue; + if (!path.string[i + k]) continue; part.string[part.used] = path.string[i + k]; part.used++; diff --git a/level_1/fl_fss/c/fss_basic.c b/level_1/fl_fss/c/fss_basic.c index f9477ac..dd61602 100644 --- a/level_1/fl_fss/c/fss_basic.c +++ b/level_1/fl_fss/c/fss_basic.c @@ -8,10 +8,10 @@ extern "C" { #ifndef _di_fl_fss_basic_object_read_ f_return_status fl_fss_basic_object_read(f_string_dynamic_t *buffer, f_string_range_t *range, f_fss_object_t *found, f_fss_quoted_t *quoted) { #ifndef _di_level_1_parameter_checking_ - if (buffer == 0) return F_status_set_error(F_parameter); - if (buffer->used == 0) return F_status_set_error(F_parameter); - if (range == 0) return F_status_set_error(F_parameter); - if (found == 0) return F_status_set_error(F_parameter); + if (!buffer) return F_status_set_error(F_parameter); + if (!buffer->used ) return F_status_set_error(F_parameter); + if (!range) return F_status_set_error(F_parameter); + if (!found) return F_status_set_error(F_parameter); if (range->start > range->stop) return F_status_set_error(F_parameter); if (range->start >= buffer->used) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ @@ -40,10 +40,10 @@ extern "C" { #ifndef _di_fl_fss_basic_content_read_ f_return_status fl_fss_basic_content_read(f_string_dynamic_t *buffer, f_string_range_t *range, f_fss_content_t *found) { #ifndef _di_level_1_parameter_checking_ - if (buffer == 0) return F_status_set_error(F_parameter); - if (buffer->used == 0) return F_status_set_error(F_parameter); - if (range == 0) return F_status_set_error(F_parameter); - if (found == 0) return F_status_set_error(F_parameter); + if (!buffer) return F_status_set_error(F_parameter); + if (!buffer->used ) return F_status_set_error(F_parameter); + if (!range) return F_status_set_error(F_parameter); + if (!found) return F_status_set_error(F_parameter); if (range->start > range->stop) return F_status_set_error(F_parameter); if (range->start >= buffer->used) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ @@ -94,7 +94,7 @@ extern "C" { #ifndef _di_fl_fss_basic_object_write_ f_return_status fl_fss_basic_object_write(const f_string_static_t object, const f_fss_quoted_t quoted, f_string_range_t *range, f_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ return private_fl_fss_basic_object_write(object, quoted, range, destination); @@ -104,7 +104,7 @@ extern "C" { #ifndef _di_fl_fss_basic_content_write_ f_return_status fl_fss_basic_content_write(const f_string_static_t content, f_string_range_t *range, f_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ f_status_t status = F_none; diff --git a/level_1/fl_fss/c/fss_basic_list.c b/level_1/fl_fss/c/fss_basic_list.c index 8fbcee6..dd5571c 100644 --- a/level_1/fl_fss/c/fss_basic_list.c +++ b/level_1/fl_fss/c/fss_basic_list.c @@ -8,10 +8,10 @@ extern "C" { #ifndef _di_fl_fss_basic_list_object_read_ f_return_status fl_fss_basic_list_object_read(f_string_dynamic_t *buffer, f_string_range_t *range, f_fss_object_t *found) { #ifndef _di_level_1_parameter_checking_ - if (buffer == 0) return F_status_set_error(F_parameter); - if (buffer->used == 0) return F_status_set_error(F_parameter); - if (range == 0) return F_status_set_error(F_parameter); - if (found == 0) return F_status_set_error(F_parameter); + if (!buffer) return F_status_set_error(F_parameter); + if (!buffer->used) return F_status_set_error(F_parameter); + if (!range) return F_status_set_error(F_parameter); + if (!found) return F_status_set_error(F_parameter); if (range->start > range->stop) return F_status_set_error(F_parameter); if (range->start >= buffer->used) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ @@ -192,10 +192,10 @@ extern "C" { #ifndef _di_fl_fss_basic_list_content_read_ f_return_status fl_fss_basic_list_content_read(f_string_dynamic_t *buffer, f_string_range_t *range, f_fss_content_t *found) { #ifndef _di_level_1_parameter_checking_ - if (buffer == 0) return F_status_set_error(F_parameter); - if (buffer->used == 0) return F_status_set_error(F_parameter); - if (range == 0) return F_status_set_error(F_parameter); - if (found == 0) return F_status_set_error(F_parameter); + if (!buffer) return F_status_set_error(F_parameter); + if (!buffer->used) return F_status_set_error(F_parameter); + if (!range) return F_status_set_error(F_parameter); + if (!found) return F_status_set_error(F_parameter); if (range->start > range->stop) return F_status_set_error(F_parameter); if (range->start >= buffer->used) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ @@ -397,7 +397,7 @@ extern "C" { #ifndef _di_fl_fss_basic_list_object_write_ f_return_status fl_fss_basic_list_object_write(const f_string_static_t object, f_string_range_t *range, f_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ f_status_t status = F_none; @@ -526,7 +526,7 @@ extern "C" { #ifndef _di_fl_fss_basic_list_content_write_ f_return_status fl_fss_basic_list_content_write(const f_string_static_t content, f_string_range_t *range, f_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ f_status_t status = F_none; diff --git a/level_1/fl_fss/c/fss_extended.c b/level_1/fl_fss/c/fss_extended.c index cf69efe..5f48b2d 100644 --- a/level_1/fl_fss/c/fss_extended.c +++ b/level_1/fl_fss/c/fss_extended.c @@ -8,10 +8,10 @@ extern "C" { #ifndef _di_fl_fss_extended_object_read_ f_return_status fl_fss_extended_object_read(f_string_dynamic_t *buffer, f_string_range_t *range, f_fss_object_t *found, f_fss_quoted_t *quoted) { #ifndef _di_level_1_parameter_checking_ - if (buffer == 0) return F_status_set_error(F_parameter); - if (buffer->used == 0) return F_status_set_error(F_parameter); - if (range == 0) return F_status_set_error(F_parameter); - if (found == 0) return F_status_set_error(F_parameter); + if (!buffer) return F_status_set_error(F_parameter); + if (!buffer->used) return F_status_set_error(F_parameter); + if (!range) return F_status_set_error(F_parameter); + if (!found) return F_status_set_error(F_parameter); if (range->start > range->stop) return F_status_set_error(F_parameter); if (range->start >= buffer->used) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ @@ -40,10 +40,10 @@ extern "C" { #ifndef _di_fl_fss_extended_content_read_ f_return_status fl_fss_extended_content_read(f_string_dynamic_t *buffer, f_string_range_t *range, f_fss_content_t *found, f_fss_quoteds_t *quoteds) { #ifndef _di_level_1_parameter_checking_ - if (buffer == 0) return F_status_set_error(F_parameter); - if (buffer->used == 0) return F_status_set_error(F_parameter); - if (range == 0) return F_status_set_error(F_parameter); - if (found == 0) return F_status_set_error(F_parameter); + if (!buffer) return F_status_set_error(F_parameter); + if (!buffer->used) return F_status_set_error(F_parameter); + if (!range) return F_status_set_error(F_parameter); + if (!found) return F_status_set_error(F_parameter); if (range->start > range->stop) return F_status_set_error(F_parameter); if (range->start >= buffer->used) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ @@ -159,7 +159,7 @@ extern "C" { #ifndef _di_fl_fss_extended_object_write_ f_return_status fl_fss_extended_object_write(const f_string_static_t object, const f_fss_quoted_t quoted, f_string_range_t *range, f_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ return private_fl_fss_basic_object_write(object, quoted, range, destination); @@ -169,7 +169,7 @@ f_return_status fl_fss_extended_object_write(const f_string_static_t object, con #ifndef _di_fl_fss_extended_content_write_ f_return_status fl_fss_extended_content_write(const f_string_static_t content, const f_fss_quoted_t quoted, f_string_range_t *range, f_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ // this operates exactly like an object, syntax-wise, so just use the object write. diff --git a/level_1/fl_fss/c/fss_extended_list.c b/level_1/fl_fss/c/fss_extended_list.c index fa36d42..baee672 100644 --- a/level_1/fl_fss/c/fss_extended_list.c +++ b/level_1/fl_fss/c/fss_extended_list.c @@ -8,10 +8,10 @@ extern "C" { #ifndef _di_fl_fss_extended_list_object_read_ f_return_status fl_fss_extended_list_object_read(f_string_dynamic_t *buffer, f_string_range_t *range, f_fss_object_t *found) { #ifndef _di_level_1_parameter_checking_ - if (buffer == 0) return F_status_set_error(F_parameter); - if (buffer->used == 0) return F_status_set_error(F_parameter); - if (range == 0) return F_status_set_error(F_parameter); - if (found == 0) return F_status_set_error(F_parameter); + if (!buffer) return F_status_set_error(F_parameter); + if (!buffer->used) return F_status_set_error(F_parameter); + if (!range) return F_status_set_error(F_parameter); + if (!found) return F_status_set_error(F_parameter); if (range->start > range->stop) return F_status_set_error(F_parameter); if (range->start >= buffer->used) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ @@ -200,10 +200,10 @@ extern "C" { #ifndef _di_fl_fss_extended_list_content_read_ f_return_status fl_fss_extended_list_content_read(f_string_dynamic_t *buffer, f_string_range_t *range, f_fss_nest_t *found) { #ifndef _di_level_1_parameter_checking_ - if (buffer == 0) return F_status_set_error(F_parameter); - if (buffer->used == 0) return F_status_set_error(F_parameter); - if (range == 0) return F_status_set_error(F_parameter); - if (found == 0) return F_status_set_error(F_parameter); + if (!buffer) return F_status_set_error(F_parameter); + if (!buffer->used) return F_status_set_error(F_parameter); + if (!range) return F_status_set_error(F_parameter); + if (!found) return F_status_set_error(F_parameter); if (range->start > range->stop) return F_status_set_error(F_parameter); if (range->start >= buffer->used) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ @@ -687,7 +687,7 @@ extern "C" { last_newline = range->start; line_start = range->start + 1; - if (depth == 0) { + if (!depth) { status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) { @@ -776,14 +776,14 @@ extern "C" { f_macro_fss_objects_t_delete_simple(objects); if (range->start > range->stop) { - if (depth == 0) { + if (!depth) { return F_status_set_error(F_unterminated_stop); } return F_status_set_error(F_unterminated_nest_stop); } - if (depth == 0) { + if (!depth) { return F_status_set_error(F_unterminated_eos); } @@ -794,7 +794,7 @@ extern "C" { #ifndef _di_fl_fss_extended_list_object_write_ f_return_status fl_fss_extended_list_object_write(const f_string_static_t object, f_string_range_t *range, f_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ f_status_t status = F_none; @@ -922,7 +922,7 @@ extern "C" { #ifndef _di_fl_fss_extended_list_content_write_ f_return_status fl_fss_extended_list_content_write(const f_string_static_t content, f_string_range_t *range, f_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ // @todo diff --git a/level_1/fl_fss/c/private-fss.c b/level_1/fl_fss/c/private-fss.c index d7bbede..7fd9770 100644 --- a/level_1/fl_fss/c/private-fss.c +++ b/level_1/fl_fss/c/private-fss.c @@ -148,7 +148,7 @@ extern "C" { } // identify where the object ends. - if (quote == 0) { + if (!quote) { status = F_none; while (range->start <= range->stop && range->start < buffer->used) { diff --git a/level_1/fl_print/c/print.c b/level_1/fl_print/c/print.c index e466f62..f1d6479 100644 --- a/level_1/fl_print/c/print.c +++ b/level_1/fl_print/c/print.c @@ -7,7 +7,7 @@ extern "C" { #ifndef _di_fl_print_trim_string_ f_return_status fl_print_trim_string(FILE *output, const f_string_t string, const f_string_length_t length) { #ifndef _di_level_1_parameter_checking_ - if (string == 0) return F_status_set_error(F_parameter); + if (!string) return F_status_set_error(F_parameter); if (length < 1) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ @@ -30,7 +30,7 @@ extern "C" { } // for for (; i < length; i += f_macro_utf_byte_width(string[i])) { - if (string[i] == 0) continue; + if (!string[i]) continue; width_max = (length - i) + 1; status = f_utf_is_whitespace(string + i, width_max); @@ -59,9 +59,9 @@ extern "C" { // all whitespaces found so far must be printed when a non-whitespace is found. if (status == F_false) { for (; i < j; i++) { - if (string[i] == 0) continue; + if (!string[i]) continue; - if (fputc(string[i], output) == 0) return F_status_set_error(F_output); + if (!fputc(string[i], output)) return F_status_set_error(F_output); } // for break; @@ -71,7 +71,7 @@ extern "C" { if (status == F_true) break; } - if (fputc(string[i], output) == 0) return F_status_set_error(F_output); + if (!fputc(string[i], output)) return F_status_set_error(F_output); } // for return F_none; @@ -81,7 +81,7 @@ extern "C" { #ifndef _di_fl_print_trim_string_dynamic_ f_return_status fl_print_trim_string_dynamic(FILE *output, const f_string_static_t buffer) { #ifndef _di_level_1_parameter_checking_ - if (buffer.used == 0) return F_status_set_error(F_parameter); + if (!buffer.used) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ register f_string_length_t i = 0; @@ -102,7 +102,7 @@ extern "C" { } // for for (; i < buffer.used; i += f_macro_utf_byte_width(buffer.string[i])) { - if (buffer.string[i] == 0) continue; + if (!buffer.string[i]) continue; width_max = (buffer.used - i) + 1; status = f_utf_is_whitespace(buffer.string + i, width_max); @@ -131,9 +131,9 @@ extern "C" { // all whitespaces found so far must be printed when a non-whitespace is found. if (status == F_false) { for (; i < j; i++) { - if (buffer.string[i] == 0) continue; + if (!buffer.string[i]) continue; - if (fputc(buffer.string[i], output) == 0) return F_status_set_error(F_output); + if (!fputc(buffer.string[i], output)) return F_status_set_error(F_output); } // for break; @@ -145,7 +145,7 @@ extern "C" { } } - if (fputc(buffer.string[i], output) == 0) return F_status_set_error(F_output); + if (!fputc(buffer.string[i], output)) return F_status_set_error(F_output); } // for return F_none; @@ -157,7 +157,7 @@ extern "C" { #ifndef _di_level_1_parameter_checking_ if (range.start < 0) return F_status_set_error(F_parameter); if (range.stop < range.start) return F_status_set_error(F_parameter); - if (buffer.used == 0) return F_status_set_error(F_parameter); + if (!buffer.used) return F_status_set_error(F_parameter); if (range.start >= buffer.used) return F_status_set_error(F_parameter); if (range.stop >= buffer.used) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ @@ -181,7 +181,7 @@ extern "C" { } // for for (uint8_t width_i = f_macro_utf_byte_width(buffer.string[i]); i <= range.stop; i += width_i) { - if (buffer.string[i] == 0) { + if (!buffer.string[i]) { width_i = 1; continue; } @@ -217,7 +217,7 @@ extern "C" { // all whitespaces found so far must be printed when a non-whitespace is found. if (status == F_false) { for (; i <= j; i += width_i) { - if (buffer.string[i] == 0) { + if (!buffer.string[i]) { width_i = 1; continue; } @@ -225,7 +225,7 @@ extern "C" { width_i = f_macro_utf_byte_width(buffer.string[i]); for (uint8_t k = 0; k < width_i; k++) { - if (fputc(buffer.string[i + k], output) == 0) return F_status_set_error(F_output); + if (!fputc(buffer.string[i + k], output)) return F_status_set_error(F_output); } // for } // for @@ -239,7 +239,7 @@ extern "C" { } for (uint8_t k = 0; k < width_i; k++) { - if (fputc(buffer.string[i + k], output) == 0) return F_status_set_error(F_output); + if (!fputc(buffer.string[i + k], output)) return F_status_set_error(F_output); } // for } // for @@ -250,7 +250,7 @@ extern "C" { #ifndef _di_fl_print_trim_utf_string_ f_return_status fl_print_trim_utf_string(FILE *output, const f_utf_string_t string, const f_utf_string_length_t length) { #ifndef _di_level_1_parameter_checking_ - if (string == 0) return F_status_set_error(F_parameter); + if (!string) return F_status_set_error(F_parameter); if (length < 1) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ @@ -270,7 +270,7 @@ extern "C" { } // for for (; i < length; i++) { - if (string[i] == 0) continue; + if (!string[i]) continue; status = f_utf_character_is_whitespace(string[i]); @@ -297,9 +297,9 @@ extern "C" { // all whitespaces found so far must be printed when a non-whitespace is found. if (status == F_false) { for (; i < j; i++) { - if (string[i] == 0) continue; + if (!string[i]) continue; - if (fputc(string[i], output) == 0) return F_status_set_error(F_output); + if (!fputc(string[i], output)) return F_status_set_error(F_output); } // for break; @@ -309,7 +309,7 @@ extern "C" { if (status == F_true) break; } - if (fputc(string[i], output) == 0) return F_status_set_error(F_output); + if (!fputc(string[i], output)) return F_status_set_error(F_output); } // for return F_none; @@ -319,7 +319,7 @@ extern "C" { #ifndef _di_fl_print_trim_utf_string_dynamic_ f_return_status fl_print_trim_utf_string_dynamic(FILE *output, const f_utf_string_static_t buffer) { #ifndef _di_level_1_parameter_checking_ - if (buffer.used == 0) return F_status_set_error(F_parameter); + if (!buffer.used) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ register f_utf_string_length_t i = 0; @@ -338,7 +338,7 @@ extern "C" { } // for for (; i < buffer.used; i++) { - if (buffer.string[i] == 0) continue; + if (!buffer.string[i]) continue; status = f_utf_character_is_whitespace(buffer.string[i]); @@ -365,9 +365,9 @@ extern "C" { // all whitespaces found so far must be printed when a non-whitespace is found. if (status == F_false) { for (; i < j; i++) { - if (buffer.string[i] == 0) continue; + if (!buffer.string[i]) continue; - if (fputc(buffer.string[i], output) == 0) return F_status_set_error(F_output); + if (!fputc(buffer.string[i], output)) return F_status_set_error(F_output); } // for break; @@ -379,7 +379,7 @@ extern "C" { } } - if (fputc(buffer.string[i], output) == 0) return F_status_set_error(F_output); + if (!fputc(buffer.string[i], output)) return F_status_set_error(F_output); } // for return F_none; @@ -391,7 +391,7 @@ extern "C" { #ifndef _di_level_1_parameter_checking_ if (range.start < 0) return F_status_set_error(F_parameter); if (range.stop < range.start) return F_status_set_error(F_parameter); - if (buffer.used == 0) return F_status_set_error(F_parameter); + if (!buffer.used) return F_status_set_error(F_parameter); if (range.start >= buffer.used) return F_status_set_error(F_parameter); if (range.stop >= buffer.used) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ @@ -412,7 +412,7 @@ extern "C" { } // for for (; i <= range.stop; i++) { - if (buffer.string[i] == 0) continue; + if (!buffer.string[i]) continue; status = f_utf_character_is_whitespace(buffer.string[i]); @@ -439,9 +439,9 @@ extern "C" { // all whitespaces found so far must be printed when a non-whitespace is found. if (status == F_false) { for (; i <= j; i++) { - if (buffer.string[i] == 0) continue; + if (!buffer.string[i]) continue; - if (fputc(buffer.string[i], output) == 0) return F_status_set_error(F_output); + if (!fputc(buffer.string[i], output)) return F_status_set_error(F_output); } // for break; @@ -451,7 +451,7 @@ extern "C" { if (status == F_true) break; } - if (fputc(buffer.string[i], output) == 0) return F_status_set_error(F_output); + if (!fputc(buffer.string[i], output)) return F_status_set_error(F_output); } // for return F_none; diff --git a/level_1/fl_status/c/status.c b/level_1/fl_status/c/status.c index ac6992a..76d340a 100644 --- a/level_1/fl_status/c/status.c +++ b/level_1/fl_status/c/status.c @@ -7,7 +7,7 @@ extern "C" { #ifndef _di_fl_status_to_string_ f_return_status fl_status_to_string(const f_status_t code, f_string_t *string) { #ifndef _di_level_1_parameter_checking_ - if (string == 0) return F_status_set_error(F_parameter); + if (!string) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ f_status_t unmasked_code = F_status_set_fine(code); diff --git a/level_1/fl_string/c/private-string.c b/level_1/fl_string/c/private-string.c index 12f1e0f..a63750c 100644 --- a/level_1/fl_string/c/private-string.c +++ b/level_1/fl_string/c/private-string.c @@ -49,7 +49,7 @@ extern "C" { break; } - if (source[i] == 0) { + if (!source[i]) { if (i > 0) { if (i > first) { size = i - first; @@ -64,7 +64,7 @@ extern "C" { } } - while (i + 1 < length && source[i + 1] == 0) { + while (i + 1 < length && !source[i + 1]) { i++; } // while @@ -85,11 +85,11 @@ extern "C" { for (; i1 < stop1 && i2 < stop2; i1++, i2++) { // skip past NULL in string1. - while (i1 < stop1 && string1[i1] == 0) i1++; + while (i1 < stop1 && !string1[i1]) i1++; if (i1 == stop1) break; // skip past NULL in string2. - while (i2 < stop2 && string2[i2] == 0) i2++; + while (i2 < stop2 && !string2[i2]) i2++; if (i2 == stop2) break; if (string1[i1] != string2[i2]) return F_equal_to_not; @@ -121,7 +121,7 @@ extern "C" { for (; i1 < stop1; i1 += width) { // skip past NULL in string1. - while (i1 < stop1 && string1[i1] == 0) i1++; + while (i1 < stop1 && !string1[i1]) i1++; if (i1 == stop1) break; width_max = (stop1 - i1) + 1; @@ -142,7 +142,7 @@ extern "C" { for (; i2 < stop2; i2 += width) { // skip past NULL in string2. - while (i2 < stop2 && string2[i2] == 0) i2++; + while (i2 < stop2 && !string2[i2]) i2++; if (i2 == stop2) break; width_max = (stop2 - i2) + 1; @@ -171,7 +171,7 @@ extern "C" { for (f_string_length_t j = i1; j < stop1; j += width) { // skip past NULL in string1. - while (j < stop1 && string1[j] == 0) j++; + while (j < stop1 && !string1[j]) j++; if (j == stop1) break; width_max = (stop1 - j) + 1; @@ -195,7 +195,7 @@ extern "C" { for (f_string_length_t j = i2; j < stop2; j += width) { // skip past NULL in string2. - while (j < stop2 && string2[j] == 0) j++; + while (j < stop2 && !string2[j]) j++; if (j == stop2) break; width_max = (stop2 - j) + 1; @@ -221,11 +221,11 @@ extern "C" { for (; i1 < last1 && i2 < last2; i1++, i2++) { // skip past NULL in string1. - while (i1 < last1 && string1[i1] == 0) i1++; + while (i1 < last1 && !string1[i1]) i1++; if (i1 == last1) break; // skip past NULL in string2. - while (i2 < last2 && string2[i2] == 0) i2++; + while (i2 < last2 && !string2[i2]) i2++; if (i2 == last2) break; if (string1[i1] != string2[i2]) return F_equal_to_not; @@ -326,7 +326,7 @@ extern "C" { break; } - if (source[i] == 0) { + if (!source[i]) { if (i > 0) { if (i > first) { size = i - first; @@ -344,7 +344,7 @@ extern "C" { } } - while (i + 1 < length && source[i + 1] == 0) { + while (i + 1 < length && !source[i + 1]) { i++; } // while @@ -369,7 +369,7 @@ extern "C" { for (; *start <= *stop; *start += width) { // skip past NULL. - while (*start < *stop && source[*start] == 0) (*start)++; + while (*start < *stop && !source[*start]) (*start)++; if (*start > *stop) break; status = f_utf_is_whitespace(source + *start, (*stop - *start) + 1); @@ -390,9 +390,9 @@ extern "C" { for (; *stop > *start; (*stop)--) { // skip past NULL. - while (*stop > *start && source[*stop] == 0) (*stop)--; + while (*stop > *start && !source[*stop]) (*stop)--; - if (source[*stop] == 0) continue; + if (!source[*stop]) continue; if (*stop == *start) break; // each UTF-8 character of width 1 is an incomplete part. diff --git a/level_1/fl_string/c/string.c b/level_1/fl_string/c/string.c index eb759cc..6cc775c 100644 --- a/level_1/fl_string/c/string.c +++ b/level_1/fl_string/c/string.c @@ -8,10 +8,10 @@ extern "C" { #ifndef _di_fl_string_append_ f_return_status fl_string_append(const f_string_t source, const f_string_length_t length, f_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (length == 0) return F_data_not_eos; + if (!length) return F_data_not_eos; return private_fl_string_append(source, length, destination); } @@ -20,22 +20,22 @@ extern "C" { #ifndef _di_fl_string_append_assure_ f_return_status fl_string_append_assure(const f_string_t source, const f_string_length_t length, f_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (length == 0) return F_data_not_eos; + if (!length) return F_data_not_eos; if (destination->used < length) return private_fl_string_append(source, length, destination); f_string_length_t i = 1; f_string_length_t j = 1; while (i <= length && j <= destination->used) { - if (source[length - i] == 0) { + if (!source[length - i]) { i++; continue; } - if (destination->string[destination->used - j] == 0) { + if (!destination->string[destination->used - j]) { j++; continue; } @@ -55,10 +55,10 @@ extern "C" { #ifndef _di_fl_string_append_assure_nulless_ f_return_status fl_string_append_assure_nulless(const f_string_t source, const f_string_length_t length, f_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (length == 0) return F_data_not_eos; + if (!length) return F_data_not_eos; if (destination->used < length) { return private_fl_string_append_nulless(source, length, destination); @@ -68,12 +68,12 @@ extern "C" { f_string_length_t j = 1; while (i <= length && j <= destination->used) { - if (source[length - i] == 0) { + if (!source[length - i]) { i++; continue; } - if (destination->string[destination->used - j] == 0) { + if (!destination->string[destination->used - j]) { j++; continue; } @@ -93,10 +93,10 @@ extern "C" { #ifndef _di_fl_string_append_nulless_ f_return_status fl_string_append_nulless(const f_string_t source, const f_string_length_t length, f_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (length == 0) return F_data_not_eos; + if (!length) return F_data_not_eos; return private_fl_string_append_nulless(source, length, destination); } @@ -117,10 +117,10 @@ extern "C" { #ifndef _di_fl_string_dynamic_append_ f_return_status fl_string_dynamic_append(const f_string_static_t source, f_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not_eos; + if (!source.used) return F_data_not_eos; return private_fl_string_append(source.string, source.used, destination); } @@ -129,10 +129,10 @@ extern "C" { #ifndef _di_fl_string_dynamic_append_assure_ f_return_status fl_string_dynamic_append_assure(const f_string_static_t source, f_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not_eos; + if (!source.used) return F_data_not_eos; if (destination->used < source.used) { return private_fl_string_append(source.string, source.used, destination); @@ -142,12 +142,12 @@ extern "C" { f_string_length_t j = 1; while (i <= source.used && j <= destination->used) { - if (source.string[source.used - i] == 0) { + if (!source.string[source.used - i]) { i++; continue; } - if (destination->string[destination->used - j] == 0) { + if (!destination->string[destination->used - j]) { j++; continue; } @@ -167,10 +167,10 @@ extern "C" { #ifndef _di_fl_string_dynamic_append_assure_nulless_ f_return_status fl_string_dynamic_append_assure_nulless(const f_string_static_t source, f_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not_eos; + if (!source.used) return F_data_not_eos; if (destination->used < source.used) { return private_fl_string_append_nulless(source.string, source.used, destination); @@ -180,12 +180,12 @@ extern "C" { f_string_length_t j = 1; while (i <= source.used && j <= destination->used) { - if (source.string[source.used - i] == 0) { + if (!source.string[source.used - i]) { i++; continue; } - if (destination->string[destination->used - j] == 0) { + if (!destination->string[destination->used - j]) { j++; continue; } @@ -205,10 +205,10 @@ extern "C" { #ifndef _di_fl_string_dynamic_append_nulless_ f_return_status fl_string_dynamic_append_nulless(const f_string_static_t source, f_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not_eos; + if (!source.used) return F_data_not_eos; return private_fl_string_append_nulless(source.string, source.used, destination); } @@ -241,10 +241,10 @@ extern "C" { #ifndef _di_fl_string_dynamic_mash_ f_return_status fl_string_dynamic_mash(const f_string_t glue, const f_string_length_t glue_length, const f_string_static_t source, f_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not_eos; + if (!source.used) return F_data_not_eos; if (glue_length && destination->used) { const f_status_t status = private_fl_string_append(glue, glue_length, destination); @@ -258,10 +258,10 @@ extern "C" { #ifndef _di_fl_string_dynamic_mash_nulless_ f_return_status fl_string_dynamic_mash_nulless(const f_string_t glue, const f_string_length_t glue_length, const f_string_static_t source, f_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not_eos; + if (!source.used) return F_data_not_eos; if (glue_length && destination->used) { const f_status_t status = private_fl_string_append_nulless(glue, glue_length, destination); @@ -275,10 +275,10 @@ extern "C" { #ifndef _di_fl_string_dynamic_mish_ f_return_status fl_string_dynamic_mish(const f_string_t glue, const f_string_length_t glue_length, const f_string_static_t source, f_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not_eos; + if (!source.used) return F_data_not_eos; if (glue_length && destination->used) { const f_status_t status = private_fl_string_prepend(glue, glue_length, destination); @@ -292,10 +292,10 @@ extern "C" { #ifndef _di_fl_string_dynamic_mish_nulless_ f_return_status fl_string_dynamic_mish_nulless(const f_string_t glue, const f_string_length_t glue_length, const f_string_static_t source, f_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not_eos; + if (!source.used) return F_data_not_eos; if (glue_length && destination->used) { const f_status_t status = private_fl_string_prepend_nulless(glue, glue_length, destination); @@ -310,10 +310,10 @@ extern "C" { f_return_status fl_string_dynamic_partial_append(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ if (source.used <= range.stop) return F_status_set_error(F_parameter); - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not_eos; + if (!source.used) return F_data_not_eos; if (range.start > range.stop) return F_data_not_stop; return private_fl_string_append(source.string + range.start, (range.stop - range.start) + 1, destination); @@ -324,10 +324,10 @@ extern "C" { f_return_status fl_string_dynamic_partial_append_assure(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ if (source.used <= range.stop) return F_status_set_error(F_parameter); - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not_eos; + if (!source.used) return F_data_not_eos; if (range.start > range.stop) return F_data_not_stop; const f_string_length_t length = (range.stop - range.start) + 1; @@ -340,12 +340,12 @@ extern "C" { f_string_length_t j = 1; while (i <= length && j <= destination->used) { - if (source.string[range.stop - i] == 0) { + if (!source.string[range.stop - i]) { i++; continue; } - if (destination->string[destination->used - j] == 0) { + if (!destination->string[destination->used - j]) { j++; continue; } @@ -364,10 +364,10 @@ extern "C" { f_return_status fl_string_dynamic_partial_append_assure_nulless(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ if (source.used <= range.stop) return F_status_set_error(F_parameter); - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not_eos; + if (!source.used) return F_data_not_eos; if (range.start > range.stop) return F_data_not_stop; const f_string_length_t length = (range.stop - range.start) + 1; @@ -380,12 +380,12 @@ extern "C" { f_string_length_t j = 1; while (i <= length && j <= destination->used) { - if (source.string[range.stop - i] == 0) { + if (!source.string[range.stop - i]) { i++; continue; } - if (destination->string[destination->used - j] == 0) { + if (!destination->string[destination->used - j]) { j++; continue; } @@ -404,10 +404,10 @@ extern "C" { f_return_status fl_string_dynamic_partial_append_nulless(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ if (source.used <= range.stop) return F_status_set_error(F_parameter); - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not_eos; + if (!source.used) return F_data_not_eos; if (range.start > range.stop) return F_data_not_stop; return private_fl_string_append_nulless(source.string + range.start, (range.stop - range.start) + 1, destination); @@ -480,10 +480,10 @@ extern "C" { f_return_status fl_string_dynamic_partial_mash(const f_string_t glue, const f_string_length_t glue_length, const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ if (source.used <= range.stop) return F_status_set_error(F_parameter); - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not_eos; + if (!source.used) return F_data_not_eos; if (range.start > range.stop) return F_data_not_stop; if (glue_length && destination->used) { @@ -499,10 +499,10 @@ extern "C" { f_return_status fl_string_dynamic_partial_mash_nulless(const f_string_t glue, const f_string_length_t glue_length, const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ if (source.used <= range.stop) return F_status_set_error(F_parameter); - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not_eos; + if (!source.used) return F_data_not_eos; if (range.start > range.stop) return F_data_not_stop; if (glue_length && destination->used) { @@ -518,10 +518,10 @@ extern "C" { f_return_status fl_string_partial_dynamic_mish(const f_string_t glue, const f_string_length_t glue_length, const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ if (source.used <= range.stop) return F_status_set_error(F_parameter); - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not_eos; + if (!source.used) return F_data_not_eos; if (range.start > range.stop) return F_data_not_stop; if (glue_length && destination->used) { @@ -537,10 +537,10 @@ extern "C" { f_return_status fl_string_dynamic_partial_mish_nulless(const f_string_t glue, const f_string_length_t glue_length, const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ if (source.used <= range.stop) return F_status_set_error(F_parameter); - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not_eos; + if (!source.used) return F_data_not_eos; if (range.start > range.stop) return F_data_not_stop; if (glue_length && destination->used) { @@ -556,10 +556,10 @@ extern "C" { f_return_status fl_string_dynamic_partial_prepend(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ if (source.used <= range.stop) return F_status_set_error(F_parameter); - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not_eos; + if (!source.used) return F_data_not_eos; if (range.start > range.stop) return F_data_not_stop; return private_fl_string_prepend(source.string + range.start, (range.stop - range.start) + 1, destination); @@ -570,10 +570,10 @@ extern "C" { f_return_status fl_string_dynamic_partial_prepend_assure(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ if (source.used <= range.stop) return F_status_set_error(F_parameter); - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not_eos; + if (!source.used) return F_data_not_eos; if (range.start > range.stop) return F_data_not_stop; const f_string_length_t length = (range.stop - range.start) + 1; @@ -586,12 +586,12 @@ extern "C" { f_string_length_t j = 0; while (i < length && j < destination->used) { - if (source.string[i + range.start] == 0) { + if (!source.string[i + range.start]) { i++; continue; } - if (destination->string[j] == 0) { + if (!destination->string[j]) { j++; continue; } @@ -612,10 +612,10 @@ extern "C" { f_return_status fl_string_dynamic_partial_prepend_assure_nulless(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ if (source.used <= range.stop) return F_status_set_error(F_parameter); - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not_eos; + if (!source.used) return F_data_not_eos; if (range.start > range.stop) return F_data_not_stop; const f_string_length_t length = (range.stop - range.start) + 1; @@ -628,12 +628,12 @@ extern "C" { f_string_length_t j = 0; while (i < length && j < destination->used) { - if (source.string[i + range.start] == 0) { + if (!source.string[i + range.start]) { i++; continue; } - if (destination->string[j] == 0) { + if (!destination->string[j]) { j++; continue; } @@ -654,10 +654,10 @@ extern "C" { f_return_status fl_string_dynamic_partial_prepend_nulless(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ if (source.used <= range.stop) return F_status_set_error(F_parameter); - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not_eos; + if (!source.used) return F_data_not_eos; if (range.start > range.stop) return F_data_not_stop; return private_fl_string_prepend_nulless(source.string + range.start, (range.stop - range.start) + 1, destination); @@ -667,10 +667,10 @@ extern "C" { #ifndef _di_fl_string_dynamic_prepend_ f_return_status fl_string_dynamic_prepend(const f_string_static_t source, f_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not_eos; + if (!source.used) return F_data_not_eos; return private_fl_string_prepend(source.string, source.used, destination); } @@ -679,10 +679,10 @@ extern "C" { #ifndef _di_fl_string_dynamic_prepend_assure_ f_return_status fl_string_dynamic_prepend_assure(const f_string_static_t source, f_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not_eos; + if (!source.used) return F_data_not_eos; if (destination->used < source.used) { return private_fl_string_prepend(source.string, source.used, destination); @@ -692,12 +692,12 @@ extern "C" { f_string_length_t j = 0; while (i < source.used && j < destination->used) { - if (source.string[i] == 0) { + if (!source.string[i]) { i++; continue; } - if (destination->string[j] == 0) { + if (!destination->string[j]) { j++; continue; } @@ -717,10 +717,10 @@ extern "C" { #ifndef _di_fl_string_dynamic_prepend_assure_nulless_ f_return_status fl_string_dynamic_prepend_assure_nulless(const f_string_static_t source, f_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not_eos; + if (!source.used) return F_data_not_eos; if (destination->used < source.used) { return private_fl_string_prepend_nulless(source.string, source.used, destination); @@ -730,12 +730,12 @@ extern "C" { f_string_length_t j = 0; while (i < source.used && j < destination->used) { - if (source.string[i] == 0) { + if (!source.string[i]) { i++; continue; } - if (destination->string[j] == 0) { + if (!destination->string[j]) { j++; continue; } @@ -755,10 +755,10 @@ extern "C" { #ifndef _di_fl_string_dynamic_prepend_nulless_ f_return_status fl_string_dynamic_prepend_nulless(const f_string_static_t source, f_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not_eos; + if (!source.used) return F_data_not_eos; return private_fl_string_prepend_nulless(source.string, source.used, destination); } @@ -769,10 +769,10 @@ extern "C" { #ifndef _di_level_1_parameter_checking_ if (source.used <= range.start) return F_status_set_error(F_parameter); if (source.used <= range.stop) return F_status_set_error(F_parameter); - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not_eos; + if (!source.used) return F_data_not_eos; if (range.start > range.stop) return F_data_not_stop; return private_fl_string_append(source.string + range.start, (range.stop - range.start) + 1, destination); @@ -784,10 +784,10 @@ extern "C" { #ifndef _di_level_1_parameter_checking_ if (source.used <= range.start) return F_status_set_error(F_parameter); if (source.used <= range.stop) return F_status_set_error(F_parameter); - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not_eos; + if (!source.used) return F_data_not_eos; if (range.start > range.stop) return F_data_not_stop; return private_fl_string_append_nulless(source.string + range.start, (range.stop - range.start) + 1, destination); @@ -797,8 +797,8 @@ extern "C" { #ifndef _di_fl_string_dynamic_size_decrease_ f_return_status fl_string_dynamic_size_decrease(const f_string_length_t length, f_string_dynamic_t *string) { #ifndef _di_level_1_parameter_checking_ - if (length == 0) return F_status_set_error(F_parameter); - if (string == 0) return F_status_set_error(F_parameter); + if (!length) return F_status_set_error(F_parameter); + if (!string) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ f_status_t status = F_none; @@ -817,8 +817,8 @@ extern "C" { #ifndef _di_fl_string_dynamic_size_increase_ f_return_status fl_string_dynamic_size_increase(const f_string_length_t length, f_string_dynamic_t *string) { #ifndef _di_level_1_parameter_checking_ - if (length == 0) return F_status_set_error(F_parameter); - if (string == 0) return F_status_set_error(F_parameter); + if (!length) return F_status_set_error(F_parameter); + if (!string) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ return private_fl_string_dynamic_size_increase(length, string); @@ -828,7 +828,7 @@ extern "C" { #ifndef _di_fl_string_dynamic_seek_line_ f_return_status fl_string_dynamic_seek_line(const f_string_t string, f_string_range_t *range) { #ifndef _di_level_1_parameter_checking_ - if (range == 0) return F_status_set_error(F_parameter); + if (!range) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ if (!string) return F_data_not; @@ -847,7 +847,7 @@ extern "C" { #ifndef _di_fl_string_dynamic_seek_line_to_ f_return_status fl_string_dynamic_seek_line_to(const f_string_t string, f_string_range_t *range, const int8_t seek_to_this) { #ifndef _di_level_1_parameter_checking_ - if (range == 0) return F_status_set_error(F_parameter); + if (!range) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ if (!string) return F_data_not; @@ -869,7 +869,7 @@ extern "C" { #ifndef _di_fl_string_dynamic_seek_line_to_utf_character_ f_return_status fl_string_dynamic_seek_line_to_utf_character(const f_string_t string, f_string_range_t *range, const f_utf_character_t seek_to_this) { #ifndef _di_level_1_parameter_checking_ - if (range == 0) return F_status_set_error(F_parameter); + if (!range) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ if (!string) return F_data_not; @@ -887,7 +887,7 @@ extern "C" { width_max = (range->stop - range->start) + 1; width = f_macro_utf_byte_width_is(string[range->start]); - if (width == 0) { + if (!width) { width = 1; if (string[range->start] == f_string_eol[0]) return F_none_eol; @@ -925,7 +925,7 @@ extern "C" { #ifndef _di_fl_string_dynamic_seek_line_until_graph_ f_return_status fl_string_dynamic_seek_line_until_graph(const f_string_t string, f_string_range_t *range, const int8_t placeholder) { #ifndef _di_level_1_parameter_checking_ - if (range == 0) return F_status_set_error(F_parameter); + if (!range) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ if (!string) return F_data_not; @@ -943,7 +943,7 @@ extern "C" { width = f_macro_utf_byte_width_is(string[range->start]); - if (width == 0) { + if (!width) { width = 1; } // Do not operate on UTF-8 fragments that are not the first byte of the character. @@ -970,7 +970,7 @@ extern "C" { #ifndef _di_fl_string_dynamic_seek_line_until_non_graph_ f_return_status fl_string_dynamic_seek_line_until_non_graph(const f_string_t string, f_string_range_t *range, const int8_t placeholder) { #ifndef _di_level_1_parameter_checking_ - if (range == 0) return F_status_set_error(F_parameter); + if (!range) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ if (!string) return F_data_not; @@ -987,7 +987,7 @@ extern "C" { width = f_macro_utf_byte_width_is(string[range->start]); - if (width == 0) { + if (!width) { width = 1; } // Do not operate on UTF-8 fragments that are not the first byte of the character. @@ -1014,7 +1014,7 @@ extern "C" { #ifndef _di_fl_string_dynamic_seek_to_ f_return_status fl_string_dynamic_seek_to(const f_string_t string, f_string_range_t *range, const int8_t seek_to_this) { #ifndef _di_level_1_parameter_checking_ - if (range == 0) return F_status_set_error(F_parameter); + if (!range) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ if (!string) return F_data_not; @@ -1033,7 +1033,7 @@ extern "C" { #ifndef _di_fl_string_dynamic_seek_to_utf_character_ f_return_status fl_string_dynamic_seek_to_utf_character(const f_string_t string, f_string_range_t *range, const f_utf_character_t seek_to_this) { #ifndef _di_level_1_parameter_checking_ - if (range == 0) return F_status_set_error(F_parameter); + if (!range) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ if (!string) return F_data_not; @@ -1051,7 +1051,7 @@ extern "C" { width_max = (range->stop - range->start) + 1; width = f_macro_utf_byte_width_is(string[range->start]); - if (width == 0) { + if (!width) { width = 1; if (seek_width == width) { @@ -1086,11 +1086,11 @@ extern "C" { #ifndef _di_fl_string_dynamic_terminate_ f_return_status fl_string_dynamic_terminate(f_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); if (destination->used > destination->size) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (destination->used && destination->string[destination->used - 1] == 0) return F_none; + if (!destination->used && destination->string[destination->used - 1]) return F_none; if (destination->used == f_string_length_t_size) return F_status_set_error(F_string_too_large); @@ -1113,13 +1113,13 @@ extern "C" { #ifndef _di_fl_string_dynamic_terminate_after_ f_return_status fl_string_dynamic_terminate_after(f_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); if (destination->used > destination->size) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ if (destination->used) { for (; destination->used; destination->used--) { - if (destination->string[destination->used - 1] == 0) continue; + if (!destination->string[destination->used - 1]) continue; break; } // for } @@ -1145,8 +1145,8 @@ extern "C" { #ifndef _di_fl_string_dynamics_size_decrease_ f_return_status fl_string_dynamics_size_decrease(const f_array_length_t length, f_string_dynamics_t *strings) { #ifndef _di_level_1_parameter_checking_ - if (length == 0) return F_status_set_error(F_parameter); - if (strings == 0) return F_status_set_error(F_parameter); + if (!length) return F_status_set_error(F_parameter); + if (!strings) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ f_status_t status = F_none; @@ -1165,8 +1165,8 @@ extern "C" { #ifndef _di_fl_string_dynamics_size_increase_ f_return_status fl_string_dynamics_size_increase(const f_array_length_t length, f_string_dynamics_t *strings) { #ifndef _di_level_1_parameter_checking_ - if (length == 0) return F_status_set_error(F_parameter); - if (strings == 0) return F_status_set_error(F_parameter); + if (!length) return F_status_set_error(F_parameter); + if (!strings) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ f_status_t status = F_none; @@ -1188,8 +1188,8 @@ extern "C" { #ifndef _di_fl_string_lengths_size_decrease_ f_return_status fl_string_lengths_size_decrease(const f_array_length_t length, f_string_lengths_t *lengths) { #ifndef _di_level_1_parameter_checking_ - if (length == 0) return F_status_set_error(F_parameter); - if (lengths == 0) return F_status_set_error(F_parameter); + if (!length) return F_status_set_error(F_parameter); + if (!lengths) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ f_status_t status = F_none; @@ -1208,8 +1208,8 @@ extern "C" { #ifndef _di_fl_string_lengths_size_increase_ f_return_status fl_string_lengths_size_increase(const f_array_length_t length, f_string_lengths_t *lengths) { #ifndef _di_level_1_parameter_checking_ - if (length == 0) return F_status_set_error(F_parameter); - if (lengths == 0) return F_status_set_error(F_parameter); + if (!length) return F_status_set_error(F_parameter); + if (!lengths) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ f_status_t status = F_none; @@ -1235,10 +1235,10 @@ extern "C" { #ifndef _di_fl_string_mash_ f_return_status fl_string_mash(const f_string_t glue, const f_string_length_t glue_length, const f_string_t source, const f_string_length_t length, f_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (length == 0) return F_data_not_eos; + if (!length) return F_data_not_eos; if (glue_length && destination->used) { f_status_t status = private_fl_string_append(glue, glue_length, destination); @@ -1252,10 +1252,10 @@ extern "C" { #ifndef _di_fl_string_mash_nulless_ f_return_status fl_string_mash_nulless(const f_string_t glue, const f_string_length_t glue_length, const f_string_t source, const f_string_length_t length, f_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (length == 0) return F_data_not_eos; + if (!length) return F_data_not_eos; if (glue_length && destination->used) { f_status_t status = private_fl_string_append_nulless(glue, glue_length, destination); @@ -1269,10 +1269,10 @@ extern "C" { #ifndef _di_fl_string_mish_ f_return_status fl_string_mish(const f_string_t glue, const f_string_length_t glue_length, const f_string_t source, const f_string_length_t length, f_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (length == 0) return F_data_not_eos; + if (!length) return F_data_not_eos; if (glue_length && destination->used) { f_status_t status = private_fl_string_prepend(glue, glue_length, destination); @@ -1286,10 +1286,10 @@ extern "C" { #ifndef _di_fl_string_mish_nulless_ f_return_status fl_string_mish_nulless(const f_string_t glue, const f_string_length_t glue_length, const f_string_t source, const f_string_length_t length, f_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (length == 0) return F_data_not_eos; + if (!length) return F_data_not_eos; if (glue_length && destination->used) { f_status_t status = private_fl_string_prepend_nulless(glue, glue_length, destination); @@ -1303,10 +1303,10 @@ extern "C" { #ifndef _di_fl_string_prepend_ f_return_status fl_string_prepend(const f_string_t source, const f_string_length_t length, f_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (length == 0) return F_data_not_eos; + if (!length) return F_data_not_eos; return private_fl_string_prepend(source, length, destination); } @@ -1315,22 +1315,22 @@ extern "C" { #ifndef _di_fl_string_prepend_assure_ f_return_status fl_string_prepend_assure(const f_string_t source, const f_string_length_t length, f_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (length == 0) return F_data_not_eos; + if (!length) return F_data_not_eos; if (destination->used < length) return private_fl_string_prepend(source, length, destination); f_string_length_t i = 0; f_string_length_t j = 0; while (i < length && j < destination->used) { - if (source[i] == 0) { + if (!source[i]) { i++; continue; } - if (destination->string[j] == 0) { + if (!destination->string[j]) { j++; continue; } @@ -1348,22 +1348,22 @@ extern "C" { #ifndef _di_fl_string_prepend_assure_nulless_ f_return_status fl_string_prepend_assure_nulless(const f_string_t source, const f_string_length_t length, f_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (length == 0) return F_data_not_eos; + if (!length) return F_data_not_eos; if (destination->used < length) return private_fl_string_prepend_nulless(source, length, destination); f_string_length_t i = 0; f_string_length_t j = 0; while (i < length && j < destination->used) { - if (source[i] == 0) { + if (!source[i]) { i++; continue; } - if (destination->string[j] == 0) { + if (!destination->string[j]) { j++; continue; } @@ -1381,10 +1381,10 @@ extern "C" { #ifndef _di_fl_string_prepend_nulless_ f_return_status fl_string_prepend_nulless(const f_string_t source, const f_string_length_t length, f_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (length == 0) return F_data_not_eos; + if (!length) return F_data_not_eos; return private_fl_string_prepend_nulless(source, length, destination); } @@ -1393,10 +1393,10 @@ extern "C" { #ifndef _di_fl_string_rip_ f_return_status fl_string_rip(const f_string_t source, const f_string_length_t length, f_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (length == 0) return F_data_not_eos; + if (!length) return F_data_not_eos; f_string_length_t begin = 0; f_string_length_t end = length - 1; @@ -1413,10 +1413,10 @@ extern "C" { #ifndef _di_fl_string_rip_nulless_ f_return_status fl_string_rip_nulless(const f_string_t source, const f_string_length_t length, f_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (length == 0) return F_data_not_eos; + if (!length) return F_data_not_eos; f_string_length_t begin = 0; f_string_length_t end = length - 1; @@ -1433,7 +1433,7 @@ extern "C" { #ifndef _di_fl_string_seek_line_to_ f_return_status fl_string_seek_line_to(const f_string_t string, const int8_t seek_to, f_string_range_t *range) { #ifndef _di_level_1_parameter_checking_ - if (range == 0) return F_status_set_error(F_parameter); + if (!range) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ if (range->start > range->stop) return F_data_not_stop; @@ -1453,7 +1453,7 @@ extern "C" { #ifndef _di_fl_string_seek_line_to_utf_character_ f_return_status fl_string_seek_line_to_utf_character(const f_string_t string, const f_utf_character_t seek_to, f_string_range_t *range) { #ifndef _di_level_1_parameter_checking_ - if (range == 0) return F_status_set_error(F_parameter); + if (!range) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ if (range->start > range->stop) return F_data_not_stop; @@ -1471,7 +1471,7 @@ extern "C" { width = f_macro_utf_byte_width_is(string[range->start]); - if (width == 0) { + if (!width) { width = 1; if (string[range->start] == f_string_eol[0]) return F_none_eol; @@ -1504,7 +1504,7 @@ extern "C" { #ifndef _di_fl_string_seek_line_until_graph_ f_return_status fl_string_seek_line_until_graph(const f_string_t string, const int8_t placeholder, f_string_range_t *range) { #ifndef _di_level_1_parameter_checking_ - if (range == 0) return F_status_set_error(F_parameter); + if (!range) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ if (range->start > range->stop) return F_data_not_stop; @@ -1520,7 +1520,7 @@ extern "C" { width = f_macro_utf_byte_width_is(string[range->start]); - if (width == 0) { + if (!width) { width = 1; } // Do not operate on UTF-8 fragments that are not the first byte of the character. @@ -1547,7 +1547,7 @@ extern "C" { #ifndef _di_fl_string_seek_line_until_non_graph_ f_return_status fl_string_seek_line_until_non_graph(const f_string_t string, const int8_t placeholder, f_string_range_t *range) { #ifndef _di_level_1_parameter_checking_ - if (range == 0) return F_status_set_error(F_parameter); + if (!range) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ if (range->start > range->stop) return F_data_not_stop; @@ -1566,7 +1566,7 @@ extern "C" { width = f_macro_utf_byte_width_is(string[range->start]); - if (width == 0) { + if (!width) { width = 1; } // Do not operate on UTF-8 fragments that are not the first byte of the character. @@ -1593,7 +1593,7 @@ extern "C" { #ifndef _di_fl_string_seek_to_ f_return_status fl_string_seek_to(const f_string_t string, const int8_t seek_to, f_string_range_t *range) { #ifndef _di_level_1_parameter_checking_ - if (range == 0) return F_status_set_error(F_parameter); + if (!range) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ if (range->start > range->stop) return F_data_not_stop; @@ -1611,7 +1611,7 @@ extern "C" { #ifndef _di_fl_string_seek_to_utf_character_ f_return_status fl_string_seek_to_utf_character(const f_string_t string, const f_utf_character_t seek_to, f_string_range_t *range) { #ifndef _di_level_1_parameter_checking_ - if (range == 0) return F_status_set_error(F_parameter); + if (!range) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ if (range->start > range->stop) return F_data_not_stop; @@ -1629,7 +1629,7 @@ extern "C" { width = f_macro_utf_byte_width_is(string[range->start]); - if (width == 0) { + if (!width) { width = 1; if (seek_width == width) { diff --git a/level_1/fl_utf/c/private-utf.c b/level_1/fl_utf/c/private-utf.c index 6105c0f..fb1b68f 100644 --- a/level_1/fl_utf/c/private-utf.c +++ b/level_1/fl_utf/c/private-utf.c @@ -101,11 +101,11 @@ extern "C" { for (; i1 < stop1 && i2 < stop2; i1++, i2++) { // skip past NULL in string1. - while (i1 < stop1 && string1[i1] == 0) i1++; + while (i1 < stop1 && !string1[i1]) i1++; if (i1 == stop1) break; // skip past NULL in string2. - while (i2 < stop2 && string2[i2] == 0) i2++; + while (i2 < stop2 && !string2[i2]) i2++; if (i2 == stop2) break; if (string1[i1] != string2[i2]) return F_equal_to_not; @@ -135,7 +135,7 @@ extern "C" { for (; i1 < stop1; i1++) { // skip past NULL in string1. - while (i1 < stop1 && string1[i1] == 0) i1++; + while (i1 < stop1 && !string1[i1]) i1++; if (i1 == stop1) break; status = f_utf_character_is_whitespace(string1[i1]); @@ -154,7 +154,7 @@ extern "C" { for (; i2 < stop2; i2++) { // skip past NULL in string2. - while (i2 < stop2 && string2[i2] == 0) i2++; + while (i2 < stop2 && !string2[i2]) i2++; if (i2 == stop2) break; status = f_utf_character_is_whitespace(string2[i2]); @@ -181,7 +181,7 @@ extern "C" { for (f_utf_string_length_t j = i1; j < stop1; j++) { // skip past NULL in string1. - while (j < stop1 && string1[j] == 0) j++; + while (j < stop1 && !string1[j]) j++; if (j == stop1) break; status = f_utf_character_is_whitespace(string1[j]); @@ -203,7 +203,7 @@ extern "C" { for (f_utf_string_length_t j = i2; j < stop2; j++) { // skip past NULL in string2. - while (j < stop2 && string2[j] == 0) j++; + while (j < stop2 && !string2[j]) j++; if (j == stop2) break; status = f_utf_character_is_whitespace(string2[j]); @@ -227,11 +227,11 @@ extern "C" { for (; i1 < last1 && i2 < last2; i1++, i2++) { // skip past NULL in string1. - while (i1 < last1 && string1[i1] == 0) i1++; + while (i1 < last1 && !string1[i1]) i1++; if (i1 == last1) break; // skip past NULL in string2. - while (i2 < last2 && string2[i2] == 0) i2++; + while (i2 < last2 && !string2[i2]) i2++; if (i2 == last2) break; if (string1[i1] != string2[i2]) return F_equal_to_not; @@ -365,7 +365,7 @@ extern "C" { for (; *start <= *stop; (*start)++) { // skip past NULL. - while (*start < *stop && source[*start] == 0) (*start)++; + while (*start < *stop && !source[*start]) (*start)++; if (*start > *stop) break; status = f_utf_character_is_whitespace(source[*start]); @@ -384,9 +384,9 @@ extern "C" { for (; *stop > *start; (*stop)--) { // skip past NULL. - while (*stop > *start && source[*stop] == 0) (*stop)--; + while (*stop > *start && !source[*stop]) (*stop)--; - if (source[*stop] == 0) continue; + if (!source[*stop]) continue; if (*stop == *start) break; status = f_utf_character_is_whitespace(source[*stop]); diff --git a/level_1/fl_utf/c/utf.c b/level_1/fl_utf/c/utf.c index b7e6e60..7f75bad 100644 --- a/level_1/fl_utf/c/utf.c +++ b/level_1/fl_utf/c/utf.c @@ -8,10 +8,10 @@ extern "C" { #ifndef _di_fl_utf_string_append_ f_return_status fl_utf_string_append(const f_utf_string_t source, const f_utf_string_length_t length, f_utf_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (length == 0) return F_data_not_eos; + if (!length) return F_data_not_eos; return private_fl_utf_string_append(source, length, destination); } @@ -20,10 +20,10 @@ extern "C" { #ifndef _di_fl_utf_string_append_assure_ f_return_status fl_utf_string_append_assure(const f_utf_string_t source, const f_utf_string_length_t length, f_utf_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (length == 0) return F_data_not_eos; + if (!length) return F_data_not_eos; if (destination->used < length) { return private_fl_utf_string_append(source, length, destination); @@ -59,10 +59,10 @@ extern "C" { #ifndef _di_fl_utf_string_append_assure_nulless_ f_return_status fl_utf_string_append_assure_nulless(const f_utf_string_t source, const f_utf_string_length_t length, f_utf_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (length == 0) return F_data_not_eos; + if (!length) return F_data_not_eos; if (destination->used < length) { return private_fl_utf_string_append_nulless(source, length, destination); @@ -98,10 +98,10 @@ extern "C" { #ifndef _di_fl_utf_string_append_nulless_ f_return_status fl_utf_string_append_nulless(const f_utf_string_t source, const f_utf_string_length_t length, f_utf_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (length == 0) return F_data_not_eos; + if (!length) return F_data_not_eos; return private_fl_utf_string_append_nulless(source, length, destination); } @@ -122,10 +122,10 @@ extern "C" { #ifndef _di_fl_utf_string_dynamic_append_ f_return_status fl_utf_string_dynamic_append(const f_utf_string_static_t source, f_utf_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not_eos; + if (!source.used) return F_data_not_eos; return private_fl_utf_string_append(source.string, source.used, destination); } @@ -134,10 +134,10 @@ extern "C" { #ifndef _di_fl_utf_string_dynamic_append_assure_ f_return_status fl_utf_string_dynamic_append_assure(const f_utf_string_static_t source, f_utf_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not_eos; + if (!source.used) return F_data_not_eos; if (destination->used < source.used) { return private_fl_utf_string_append(source.string, source.used, destination); @@ -173,10 +173,10 @@ extern "C" { #ifndef _di_fl_utf_string_dynamic_append_assure_nulless_ f_return_status fl_utf_string_dynamic_append_assure_nulless(const f_utf_string_static_t source, f_utf_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not_eos; + if (!source.used) return F_data_not_eos; if (destination->used < source.used) { return private_fl_utf_string_append_nulless(source.string, source.used, destination); @@ -212,10 +212,10 @@ extern "C" { #ifndef _di_fl_utf_string_dynamic_append_nulless_ f_return_status fl_utf_string_dynamic_append_nulless(const f_utf_string_static_t source, f_utf_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not_eos; + if (!source.used) return F_data_not_eos; return private_fl_utf_string_append_nulless(source.string, source.used, destination); } @@ -236,10 +236,10 @@ extern "C" { #ifndef _di_fl_utf_string_dynamic_mash_ f_return_status fl_utf_string_dynamic_mash(const f_utf_string_t glue, const f_utf_string_length_t glue_length, const f_utf_string_static_t source, f_utf_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not_eos; + if (!source.used) return F_data_not_eos; if (glue_length > 0 && destination->used > 0) { const f_status_t status = private_fl_utf_string_append(glue, glue_length, destination); @@ -253,10 +253,10 @@ extern "C" { #ifndef _di_fl_utf_string_dynamic_mash_nulless_ f_return_status fl_utf_string_dynamic_mash_nulless(const f_utf_string_t glue, const f_utf_string_length_t glue_length, const f_utf_string_static_t source, f_utf_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not_eos; + if (!source.used) return F_data_not_eos; if (glue_length > 0 && destination->used > 0) { const f_status_t status = private_fl_utf_string_append_nulless(glue, glue_length, destination); @@ -270,10 +270,10 @@ extern "C" { #ifndef _di_fl_utf_string_dynamic_mish_ f_return_status fl_utf_string_dynamic_mish(const f_utf_string_t glue, const f_utf_string_length_t glue_length, const f_utf_string_static_t source, f_utf_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not_eos; + if (!source.used) return F_data_not_eos; if (glue_length > 0 && destination->used > 0) { const f_status_t status = private_fl_utf_string_prepend(glue, glue_length, destination); @@ -287,10 +287,10 @@ extern "C" { #ifndef _di_fl_utf_string_dynamic_mish_nulless_ f_return_status fl_utf_string_dynamic_mish_nulless(const f_utf_string_t glue, const f_utf_string_length_t glue_length, const f_utf_string_static_t source, f_utf_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not_eos; + if (!source.used) return F_data_not_eos; if (glue_length > 0 && destination->used > 0) { const f_status_t status = private_fl_utf_string_prepend_nulless(glue, glue_length, destination); @@ -305,10 +305,10 @@ extern "C" { f_return_status fl_utf_string_dynamic_partial_append(const f_utf_string_static_t source, const f_utf_string_range_t range, f_utf_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ if (source.used <= range.stop) return F_status_set_error(F_parameter); - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not_eos; + if (!source.used) return F_data_not_eos; if (range.start > range.stop) return F_data_not_stop; return private_fl_utf_string_append(source.string + range.start, (range.stop - range.start) + 1, destination); @@ -319,10 +319,10 @@ extern "C" { f_return_status fl_utf_string_dynamic_partial_append_assure(const f_utf_string_static_t source, const f_utf_string_range_t range, f_utf_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ if (source.used <= range.stop) return F_status_set_error(F_parameter); - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not_eos; + if (!source.used) return F_data_not_eos; if (range.start > range.stop) return F_data_not_stop; const f_utf_string_length_t length = (range.stop - range.start) + 1; @@ -360,10 +360,10 @@ extern "C" { f_return_status fl_utf_string_dynamic_partial_append_assure_nulless(const f_utf_string_static_t source, const f_utf_string_range_t range, f_utf_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ if (source.used <= range.stop) return F_status_set_error(F_parameter); - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not_eos; + if (!source.used) return F_data_not_eos; if (range.start > range.stop) return F_data_not_stop; const f_utf_string_length_t length = (range.stop - range.start) + 1; @@ -401,10 +401,10 @@ extern "C" { f_return_status fl_utf_string_dynamic_partial_append_nulless(const f_utf_string_static_t source, const f_utf_string_range_t range, f_utf_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ if (source.used <= range.stop) return F_status_set_error(F_parameter); - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not_eos; + if (!source.used) return F_data_not_eos; if (range.start > range.stop) return F_data_not_stop; return private_fl_utf_string_append_nulless(source.string + range.start, (range.stop - range.start) + 1, destination); @@ -437,10 +437,10 @@ extern "C" { f_return_status fl_utf_string_dynamic_partial_mash(const f_utf_string_t glue, const f_utf_string_length_t glue_length, const f_utf_string_static_t source, const f_utf_string_range_t range, f_utf_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ if (source.used <= range.stop) return F_status_set_error(F_parameter); - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not_eos; + if (!source.used) return F_data_not_eos; if (range.start > range.stop) return F_data_not_stop; if (glue_length > 0 && destination->used > 0) { @@ -456,10 +456,10 @@ extern "C" { f_return_status fl_utf_string_dynamic_partial_mash_nulless(const f_utf_string_t glue, const f_utf_string_length_t glue_length, const f_utf_string_static_t source, const f_utf_string_range_t range, f_utf_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ if (source.used <= range.stop) return F_status_set_error(F_parameter); - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not_eos; + if (!source.used) return F_data_not_eos; if (range.start > range.stop) return F_data_not_stop; if (glue_length > 0 && destination->used > 0) { @@ -475,10 +475,10 @@ extern "C" { f_return_status fl_utf_string_dynamic_partial_mish(const f_utf_string_t glue, const f_utf_string_length_t glue_length, const f_utf_string_static_t source, const f_utf_string_range_t range, f_utf_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ if (source.used <= range.stop) return F_status_set_error(F_parameter); - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not_eos; + if (!source.used) return F_data_not_eos; if (range.start > range.stop) return F_data_not_stop; if (glue_length > 0 && destination->used > 0) { @@ -494,10 +494,10 @@ extern "C" { f_return_status fl_utf_string_dynamic_partial_mish_nulless(const f_utf_string_t glue, const f_utf_string_length_t glue_length, const f_utf_string_static_t source, const f_utf_string_range_t range, f_utf_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ if (source.used <= range.stop) return F_status_set_error(F_parameter); - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not_eos; + if (!source.used) return F_data_not_eos; if (range.start > range.stop) return F_data_not_stop; if (glue_length > 0 && destination->used > 0) { @@ -513,10 +513,10 @@ extern "C" { f_return_status fl_utf_string_dynamic_partial_prepend(const f_utf_string_static_t source, const f_utf_string_range_t range, f_utf_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ if (source.used <= range.stop) return F_status_set_error(F_parameter); - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not_eos; + if (!source.used) return F_data_not_eos; if (range.start > range.stop) return F_data_not_stop; return private_fl_utf_string_prepend(source.string + range.start, (range.stop - range.start) + 1, destination); @@ -527,10 +527,10 @@ extern "C" { f_return_status fl_utf_string_dynamic_partial_prepend_assure(const f_utf_string_static_t source, const f_utf_string_range_t range, f_utf_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ if (source.used <= range.stop) return F_status_set_error(F_parameter); - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not_eos; + if (!source.used) return F_data_not_eos; if (range.start > range.stop) return F_data_not_stop; const f_utf_string_length_t length = (range.stop - range.start) + 1; @@ -570,10 +570,10 @@ extern "C" { f_return_status fl_utf_string_dynamic_partial_prepend_assure_nulless(const f_utf_string_static_t source, const f_utf_string_range_t range, f_utf_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ if (source.used <= range.stop) return F_status_set_error(F_parameter); - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not_eos; + if (!source.used) return F_data_not_eos; if (range.start > range.stop) return F_data_not_stop; const f_utf_string_length_t length = (range.stop - range.start) + 1; @@ -613,10 +613,10 @@ extern "C" { f_return_status fl_utf_string_dynamic_partial_prepend_nulless(const f_utf_string_static_t source, const f_utf_string_range_t range, f_utf_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ if (source.used <= range.stop) return F_status_set_error(F_parameter); - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not_eos; + if (!source.used) return F_data_not_eos; if (range.start > range.stop) return F_data_not_stop; return private_fl_utf_string_prepend_nulless(source.string + range.start, (range.stop - range.start) + 1, destination); @@ -626,10 +626,10 @@ extern "C" { #ifndef _di_fl_utf_string_dynamic_prepend_ f_return_status fl_utf_string_dynamic_prepend(const f_utf_string_static_t source, f_utf_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not_eos; + if (!source.used) return F_data_not_eos; return private_fl_utf_string_prepend(source.string, source.used, destination); } @@ -638,10 +638,10 @@ extern "C" { #ifndef _di_fl_utf_string_dynamic_prepend_assure_ f_return_status fl_utf_string_dynamic_prepend_assure(const f_utf_string_static_t source, f_utf_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not_eos; + if (!source.used) return F_data_not_eos; if (destination->used < source.used) { return private_fl_utf_string_prepend(source.string, source.used, destination); @@ -677,10 +677,10 @@ extern "C" { #ifndef _di_fl_utf_string_dynamic_prepend_assure_nulless_ f_return_status fl_utf_string_dynamic_prepend_assure_nulless(const f_utf_string_static_t source, f_utf_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not_eos; + if (!source.used) return F_data_not_eos; if (destination->used < source.used) { return private_fl_utf_string_prepend_nulless(source.string, source.used, destination); @@ -716,10 +716,10 @@ extern "C" { #ifndef _di_fl_utf_string_dynamic_prepend_nulless_ f_return_status fl_utf_string_dynamic_prepend_nulless(const f_utf_string_static_t source, f_utf_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not_eos; + if (!source.used) return F_data_not_eos; return private_fl_utf_string_prepend_nulless(source.string, source.used, destination); } @@ -730,10 +730,10 @@ extern "C" { #ifndef _di_level_1_parameter_checking_ if (source.used <= range.start) return F_status_set_error(F_parameter); if (source.used <= range.stop) return F_status_set_error(F_parameter); - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not_eos; + if (!source.used) return F_data_not_eos; if (range.start > range.stop) return F_data_not_stop; return private_fl_utf_string_append(source.string + range.start, (range.stop - range.start) + 1, destination); @@ -745,10 +745,10 @@ extern "C" { #ifndef _di_level_1_parameter_checking_ if (source.used <= range.start) return F_status_set_error(F_parameter); if (source.used <= range.stop) return F_status_set_error(F_parameter); - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (source.used == 0) return F_data_not_eos; + if (!source.used) return F_data_not_eos; if (range.start > range.stop) return F_data_not_stop; return private_fl_utf_string_append_nulless(source.string + range.start, (range.stop - range.start) + 1, destination); @@ -758,12 +758,12 @@ extern "C" { #ifndef _di_fl_utf_string_dynamic_seek_line_to_ f_return_status fl_utf_string_dynamic_seek_line_to(const f_utf_string_static_t buffer, f_utf_string_range_t *range, const f_utf_character_t seek_to_this) { #ifndef _di_level_1_parameter_checking_ - if (range == 0) return F_status_set_error(F_parameter); + if (!range) return F_status_set_error(F_parameter); if (buffer.used <= range->start) return F_status_set_error(F_parameter); if (buffer.used <= range->stop) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (buffer.used == 0) return F_data_not_eos; + if (!buffer.used) return F_data_not_eos; if (range->start > range->stop) return F_data_not_stop; if (f_macro_utf_character_t_width_is(buffer.string[range->start]) == 1) { @@ -791,12 +791,12 @@ extern "C" { #ifndef _di_fl_utf_string_dynamic_seek_line_to_char_ f_return_status fl_utf_string_dynamic_seek_line_to_char(const f_utf_string_static_t buffer, f_utf_string_range_t *range, const int8_t seek_to_this) { #ifndef _di_level_1_parameter_checking_ - if (range == 0) return F_status_set_error(F_parameter); + if (!range) return F_status_set_error(F_parameter); if (buffer.used <= range->start) return F_status_set_error(F_parameter); if (buffer.used <= range->stop) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (buffer.used == 0) return F_data_not_eos; + if (!buffer.used) return F_data_not_eos; if (range->start > range->stop) return F_data_not_stop; f_utf_character_t seek_to_character = seek_to_this << 24; @@ -828,12 +828,12 @@ extern "C" { #ifndef _di_fl_utf_string_dynamic_seek_line_until_graph_ f_return_status fl_utf_string_dynamic_seek_line_until_graph(const f_utf_string_static_t buffer, f_utf_string_range_t *range, const f_utf_character_t placeholder) { #ifndef _di_level_1_parameter_checking_ - if (range == 0) return F_status_set_error(F_parameter); + if (!range) return F_status_set_error(F_parameter); if (buffer.used <= range->start) return F_status_set_error(F_parameter); if (buffer.used <= range->stop) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (buffer.used == 0) return F_data_not_eos; + if (!buffer.used) return F_data_not_eos; if (range->start > range->stop) return F_data_not_stop; f_status_t status = F_none; @@ -866,12 +866,12 @@ extern "C" { #ifndef _di_fl_utf_string_dynamic_seek_line_until_non_graph_ f_return_status fl_utf_string_dynamic_seek_line_until_non_graph(const f_utf_string_static_t buffer, f_utf_string_range_t *range, const f_utf_character_t placeholder) { #ifndef _di_level_1_parameter_checking_ - if (range == 0) return F_status_set_error(F_parameter); + if (!range) return F_status_set_error(F_parameter); if (buffer.used <= range->start) return F_status_set_error(F_parameter); if (buffer.used <= range->stop) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (buffer.used == 0) return F_data_not_eos; + if (!buffer.used) return F_data_not_eos; if (range->start > range->stop) return F_data_not_stop; f_status_t status = F_none; @@ -904,12 +904,12 @@ extern "C" { #ifndef _di_fl_utf_string_dynamic_seek_to_ f_return_status fl_utf_string_dynamic_seek_to(const f_utf_string_static_t buffer, f_utf_string_range_t *range, const f_utf_character_t seek_to_this) { #ifndef _di_level_1_parameter_checking_ - if (range == 0) return F_status_set_error(F_parameter); + if (!range) return F_status_set_error(F_parameter); if (buffer.used <= range->start) return F_status_set_error(F_parameter); if (buffer.used <= range->stop) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (buffer.used == 0) return F_data_not_eos; + if (!buffer.used) return F_data_not_eos; if (range->start > range->stop) return F_data_not_stop; if (f_macro_utf_character_t_width_is(buffer.string[range->start]) == 1) { @@ -934,12 +934,12 @@ extern "C" { #ifndef _di_fl_utf_string_dynamic_seek_to_char_ f_return_status fl_utf_string_dynamic_seek_to_char(const f_utf_string_static_t buffer, f_utf_string_range_t *range, const int8_t seek_to_this) { #ifndef _di_level_1_parameter_checking_ - if (range == 0) return F_status_set_error(F_parameter); + if (!range) return F_status_set_error(F_parameter); if (buffer.used <= range->start) return F_status_set_error(F_parameter); if (buffer.used <= range->stop) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (buffer.used == 0) return F_data_not_eos; + if (!buffer.used) return F_data_not_eos; if (range->start > range->stop) return F_data_not_stop; f_utf_character_t seek_to_character = seek_to_this << 24; @@ -966,7 +966,7 @@ extern "C" { #ifndef _di_fl_utf_string_dynamic_terminate_ f_return_status fl_utf_string_dynamic_terminate(f_utf_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); if (destination->used > destination->size) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ @@ -997,14 +997,13 @@ extern "C" { #ifndef _di_fl_utf_string_dynamic_terminate_after_ f_return_status fl_utf_string_dynamic_terminate_after(f_utf_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); if (destination->used > destination->size) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ if (destination->used > 0) { for (; destination->used > 0; destination->used--) { - - if (destination->string[destination->used - 1] == 0) continue; + if (!destination->string[destination->used - 1]) continue; break; } // for } @@ -1032,10 +1031,10 @@ extern "C" { #ifndef _di_fl_utf_string_mash_ f_return_status fl_utf_string_mash(const f_utf_string_t glue, const f_utf_string_length_t glue_length, const f_utf_string_t source, const f_utf_string_length_t length, f_utf_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (length == 0) return F_data_not_eos; + if (!length) return F_data_not_eos; if (glue_length > 0 && destination->used > 0) { f_status_t status = private_fl_utf_string_append(glue, glue_length, destination); @@ -1049,10 +1048,10 @@ extern "C" { #ifndef _di_fl_utf_string_mash_nulless_ f_return_status fl_utf_string_mash_nulless(const f_utf_string_t glue, const f_utf_string_length_t glue_length, const f_utf_string_t source, const f_utf_string_length_t length, f_utf_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (length == 0) return F_data_not_eos; + if (!length) return F_data_not_eos; if (glue_length > 0 && destination->used > 0) { f_status_t status = private_fl_utf_string_append_nulless(glue, glue_length, destination); @@ -1066,10 +1065,10 @@ extern "C" { #ifndef _di_fl_utf_string_mish_ f_return_status fl_utf_string_mish(const f_utf_string_t glue, const f_utf_string_length_t glue_length, const f_utf_string_t source, const f_utf_string_length_t length, f_utf_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (length == 0) return F_data_not_eos; + if (!length) return F_data_not_eos; if (glue_length > 0 && destination->used > 0) { f_status_t status = private_fl_utf_string_prepend(glue, glue_length, destination); @@ -1083,10 +1082,10 @@ extern "C" { #ifndef _di_fl_utf_string_mish_nulless_ f_return_status fl_utf_string_mish_nulless(const f_utf_string_t glue, const f_utf_string_length_t glue_length, const f_utf_string_t source, const f_utf_string_length_t length, f_utf_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (length == 0) return F_data_not_eos; + if (!length) return F_data_not_eos; if (glue_length > 0 && destination->used > 0) { f_status_t status = private_fl_utf_string_prepend_nulless(glue, glue_length, destination); @@ -1100,10 +1099,10 @@ extern "C" { #ifndef _di_fl_utf_string_prepend_ f_return_status fl_utf_string_prepend(const f_utf_string_t source, const f_utf_string_length_t length, f_utf_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (length == 0) return F_data_not_eos; + if (!length) return F_data_not_eos; return private_fl_utf_string_prepend(source, length, destination); } @@ -1112,10 +1111,10 @@ extern "C" { #ifndef _di_fl_utf_string_prepend_assure_ f_return_status fl_utf_string_prepend_assure(const f_utf_string_t source, const f_utf_string_length_t length, f_utf_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (length == 0) return F_data_not_eos; + if (!length) return F_data_not_eos; if (destination->used < length) { return private_fl_utf_string_prepend(source, length, destination); @@ -1151,10 +1150,10 @@ extern "C" { #ifndef _di_fl_utf_string_prepend_assure_nulless_ f_return_status fl_utf_string_prepend_assure_nulless(const f_utf_string_t source, const f_utf_string_length_t length, f_utf_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (length == 0) return F_data_not_eos; + if (!length) return F_data_not_eos; if (destination->used < length) { return private_fl_utf_string_prepend_nulless(source, length, destination); @@ -1190,10 +1189,10 @@ extern "C" { #ifndef _di_fl_utf_string_prepend_nulless_ f_return_status fl_utf_string_prepend_nulless(const f_utf_string_t source, const f_utf_string_length_t length, f_utf_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (length == 0) return F_data_not_eos; + if (!length) return F_data_not_eos; return private_fl_utf_string_prepend_nulless(source, length, destination); } @@ -1202,10 +1201,10 @@ extern "C" { #ifndef _di_fl_utf_string_rip_ f_return_status fl_utf_string_rip(const f_utf_string_t source, const f_utf_string_length_t length, f_utf_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (length == 0) return F_data_not_eos; + if (!length) return F_data_not_eos; f_utf_string_length_t begin = 0; f_utf_string_length_t end = length - 1; @@ -1222,10 +1221,10 @@ extern "C" { #ifndef _di_fl_utf_string_rip_nulless_ f_return_status fl_utf_string_rip_nulless(const f_utf_string_t source, const f_utf_string_length_t length, f_utf_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (length == 0) return F_data_not_eos; + if (!length) return F_data_not_eos; f_utf_string_length_t begin = 0; f_utf_string_length_t end = length - 1; @@ -1242,7 +1241,7 @@ extern "C" { #ifndef _di_fl_utf_string_seek_line_to_ f_return_status fl_utf_string_seek_line_to(const f_utf_string_t string, f_utf_string_range_t *range, const f_utf_character_t seek_to_this) { #ifndef _di_level_1_parameter_checking_ - if (range == 0) return F_status_set_error(F_parameter); + if (!range) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ if (range->start > range->stop) return F_data_not_stop; @@ -1273,7 +1272,7 @@ extern "C" { #ifndef _di_fl_utf_string_seek_line_to_char_ f_return_status fl_utf_string_seek_line_to_char(const f_utf_string_t string, f_utf_string_range_t *range, const int8_t seek_to_this) { #ifndef _di_level_1_parameter_checking_ - if (range == 0) return F_status_set_error(F_parameter); + if (!range) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ if (range->start > range->stop) return F_data_not_stop; @@ -1297,7 +1296,7 @@ extern "C" { #ifndef _di_fl_utf_string_seek_line_until_graph_ f_return_status fl_utf_string_seek_line_until_graph(const f_utf_string_t string, f_utf_string_range_t *range, const f_utf_character_t placeholder) { #ifndef _di_level_1_parameter_checking_ - if (range == 0) return F_status_set_error(F_parameter); + if (!range) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ if (range->start > range->stop) return F_data_not_stop; @@ -1331,7 +1330,7 @@ extern "C" { #ifndef _di_fl_utf_string_seek_line_until_non_graph_ f_return_status fl_utf_string_seek_line_until_non_graph(const f_utf_string_t string, f_utf_string_range_t *range, const f_utf_character_t placeholder) { #ifndef _di_level_1_parameter_checking_ - if (range == 0) return F_status_set_error(F_parameter); + if (!range) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ if (range->start > range->stop) return F_data_not_stop; @@ -1363,7 +1362,7 @@ extern "C" { #ifndef _di_fl_utf_string_seek_to_ f_return_status fl_utf_string_seek_to(const f_utf_string_t string, f_utf_string_range_t *range, const f_utf_character_t seek_to_this) { #ifndef _di_level_1_parameter_checking_ - if (range == 0) return F_status_set_error(F_parameter); + if (!range) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ if (range->start > range->stop) return F_data_not_stop; @@ -1389,7 +1388,7 @@ extern "C" { #ifndef _di_fl_utf_string_seek_to_char_ f_return_status fl_utf_string_seek_to_char(const f_utf_string_t string, f_utf_string_range_t *range, const int8_t seek_to_this) { #ifndef _di_level_1_parameter_checking_ - if (range == 0) return F_status_set_error(F_parameter); + if (!range) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ if (range->start > range->stop) return F_data_not_stop; diff --git a/level_1/fl_utf_file/c/private-utf_file.c b/level_1/fl_utf_file/c/private-utf_file.c index 2e6072d..5315848 100644 --- a/level_1/fl_utf_file/c/private-utf_file.c +++ b/level_1/fl_utf_file/c/private-utf_file.c @@ -14,7 +14,7 @@ extern "C" { for (; i < size_read; i += increment_by) { increment_by = 0; - if (*width == 0) { + if (!*width) { *width = f_macro_utf_byte_width(buffer_read[i]); *width_last = -1; } @@ -162,7 +162,7 @@ extern "C" { size_write = write(file.id, buffer_write, used); - if (size_write == 0) { + if (!size_write) { return F_none_stop; } diff --git a/level_1/fl_utf_file/c/utf_file.c b/level_1/fl_utf_file/c/utf_file.c index 369d834..7fa69c9 100644 --- a/level_1/fl_utf_file/c/utf_file.c +++ b/level_1/fl_utf_file/c/utf_file.c @@ -8,12 +8,12 @@ extern "C" { #ifndef _di_fl_utf_file_read_ f_return_status fl_utf_file_read(const f_file_t file, f_utf_string_dynamic_t *buffer) { #ifndef _di_level_1_parameter_checking_ - if (file.size_read == 0) return F_status_set_error(F_parameter); + if (!file.size_read) return F_status_set_error(F_parameter); if (buffer->used > buffer->size) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ if (file.id < 0) return F_status_set_error(F_file); - if (file.id == 0) return F_status_set_error(F_file_closed); + if (!file.id) return F_status_set_error(F_file_closed); f_status_t status = F_none; @@ -40,7 +40,7 @@ extern "C" { private_fl_utf_file_process_read_buffer(buffer_read, size_read, buffer, buffer_char, &width, &width_last); } // while - if (size_read == 0) { + if (!size_read) { if (width != 0) { return F_status_set_error(F_incomplete_utf_eof); } @@ -69,12 +69,12 @@ extern "C" { #ifndef _di_fl_utf_file_read_block_ f_return_status fl_utf_file_read_block(const f_file_t file, f_utf_string_dynamic_t *buffer) { #ifndef _di_level_1_parameter_checking_ - if (file.size_read == 0) return F_status_set_error(F_parameter); + if (!file.size_read) return F_status_set_error(F_parameter); if (buffer->used > buffer->size) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ if (file.id < 0) return F_status_set_error(F_file); - if (file.id == 0) return F_status_set_error(F_file_closed); + if (!file.id) return F_status_set_error(F_file_closed); f_status_t status = F_none; @@ -100,8 +100,8 @@ extern "C" { private_fl_utf_file_process_read_buffer(buffer_read, size_read, buffer, buffer_char, &width, &width_last); } - if (size_read == 0) { - if (width != 0) { + if (!size_read) { + if (width) { return F_status_set_error(F_incomplete_utf_eof); } @@ -129,12 +129,12 @@ extern "C" { #ifndef _di_fl_utf_file_read_until_ f_return_status fl_utf_file_read_until(const f_file_t file, const f_utf_string_length_t total, f_utf_string_dynamic_t *buffer) { #ifndef _di_level_1_parameter_checking_ - if (file.size_read == 0) return F_status_set_error(F_parameter); + if (!file.size_read) return F_status_set_error(F_parameter); if (buffer->used > buffer->size) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ if (file.id < 0) return F_status_set_error(F_file); - if (file.id == 0) return F_status_set_error(F_file_closed); + if (!file.id) return F_status_set_error(F_file_closed); f_status_t status = F_none; @@ -168,7 +168,7 @@ extern "C" { private_fl_utf_file_process_read_buffer(buffer_read, size_read, buffer, buffer_char, &width, &width_last); } // while - if (size_read == 0) { + if (!size_read) { if (width != 0) { return F_status_set_error(F_incomplete_utf_eof); } @@ -197,14 +197,14 @@ extern "C" { #ifndef _di_fl_utf_file_write_ f_return_status fl_utf_file_write(const f_file_t file, const f_utf_string_static_t buffer, f_utf_string_length_t *written) { #ifndef _di_level_0_parameter_checking_ - if (file.size_write == 0) return F_status_set_error(F_parameter); + if (!file.size_write) return F_status_set_error(F_parameter); if (buffer.used > buffer.size) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ if (file.id < 0) return F_status_set_error(F_file); - if (file.id == 0) return F_status_set_error(F_file_closed); + if (!file.id) return F_status_set_error(F_file_closed); - if (buffer.used == 0) { + if (!buffer.used) { *written = 0; return F_data_not; } @@ -221,14 +221,14 @@ extern "C" { #ifndef _di_fl_utf_file_write_block_ f_return_status fl_utf_file_write_block(const f_file_t file, const f_utf_string_static_t buffer, f_utf_string_length_t *written) { #ifndef _di_level_0_parameter_checking_ - if (file.size_write == 0) return F_status_set_error(F_parameter); + if (!file.size_write) return F_status_set_error(F_parameter); if (buffer.used > buffer.size) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ if (file.id < 0) return F_status_set_error(F_file); - if (file.id == 0) return F_status_set_error(F_file_closed); + if (!file.id) return F_status_set_error(F_file_closed); - if (buffer.used == 0) { + if (!buffer.used) { *written = 0; return F_data_not; } @@ -251,14 +251,14 @@ extern "C" { #ifndef _di_fl_utf_file_write_until_ f_return_status fl_utf_file_write_until(const f_file_t file, const f_utf_string_static_t buffer, const f_utf_string_length_t total, f_utf_string_length_t *written) { #ifndef _di_level_0_parameter_checking_ - if (file.size_write == 0) return F_status_set_error(F_parameter); + if (!file.size_write) return F_status_set_error(F_parameter); if (buffer.used > buffer.size) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ if (file.id < 0) return F_status_set_error(F_file); - if (file.id == 0) return F_status_set_error(F_file_closed); + if (!file.id) return F_status_set_error(F_file_closed); - if (buffer.used == 0 || total == 0) { + if (!buffer.used || !total) { *written = 0; return F_data_not; } @@ -281,16 +281,16 @@ extern "C" { #ifndef _di_fl_utf_file_write_range_ f_return_status fl_utf_file_write_range(const f_file_t file, const f_utf_string_static_t buffer, const f_utf_string_range_t range, f_utf_string_length_t *written) { #ifndef _di_level_0_parameter_checking_ - if (file.size_write == 0) return F_status_set_error(F_parameter); + if (!file.size_write) return F_status_set_error(F_parameter); if (buffer.used > buffer.size) return F_status_set_error(F_parameter); if (range.stop < range.start) return F_status_set_error(F_parameter); if (range.start >= buffer.used) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ if (file.id < 0) return F_status_set_error(F_file); - if (file.id == 0) return F_status_set_error(F_file_closed); + if (!file.id) return F_status_set_error(F_file_closed); - if (buffer.used == 0) { + if (!buffer.used) { *written = 0; return F_data_not; } diff --git a/level_2/fll_execute/c/execute.c b/level_2/fll_execute/c/execute.c index ca13376..cc8c2c2 100644 --- a/level_2/fll_execute/c/execute.c +++ b/level_2/fll_execute/c/execute.c @@ -8,11 +8,11 @@ extern "C" { #ifndef _di_fll_execute_arguments_add_ f_return_status fll_execute_arguments_add(const f_string_t source, const f_string_length_t length, f_string_dynamics_t *arguments) { #ifndef _di_level_2_parameter_checking_ - if (arguments == 0) return F_status_set_error(F_parameter); + if (!arguments) return F_status_set_error(F_parameter); if (arguments->used > arguments->size) return F_status_set_error(F_parameter); #endif // _di_level_2_parameter_checking_ - if (length == 0) return F_data_not; + if (!length) return F_data_not; f_status_t status = F_none; @@ -26,12 +26,12 @@ extern "C" { #ifndef _di_fll_execute_arguments_add_parameter_ f_return_status fll_execute_arguments_add_parameter(const f_string_t prefix, const f_string_length_t prefix_length, const f_string_t name, const f_string_length_t name_length, const f_string_t value, const f_string_length_t value_length, f_string_dynamics_t *arguments) { #ifndef _di_level_2_parameter_checking_ - if (arguments == 0) return F_status_set_error(F_parameter); + if (!arguments) return F_status_set_error(F_parameter); if (arguments->used > arguments->size) return F_status_set_error(F_parameter); #endif // _di_level_2_parameter_checking_ - if (name_length == 0) return F_data_not; - if (value_length == 0) return F_data_not; + if (!name_length) return F_data_not; + if (!value_length) return F_data_not; f_status_t status = F_none; @@ -45,17 +45,17 @@ extern "C" { #ifndef _di_fll_execute_arguments_add_parameter_set_ f_return_status fll_execute_arguments_add_parameter_set(const f_string_t prefix[], const f_string_length_t prefix_length[], const f_string_t name[], const f_string_length_t name_length[], const f_string_t value[], const f_string_length_t value_length[], const f_array_length_t size, f_string_dynamics_t *arguments) { #ifndef _di_level_2_parameter_checking_ - if (arguments == 0) return F_status_set_error(F_parameter); + if (!arguments) return F_status_set_error(F_parameter); if (arguments->used > arguments->size) return F_status_set_error(F_parameter); #endif // _di_level_2_parameter_checking_ - if (size == 0) return F_data_not; + if (!size) return F_data_not; f_status_t status = F_none; for (f_array_length_t i = 0; i < size; i++) { - if (name_length[i] == 0) continue; - if (value_length[i] == 0) continue; + if (!name_length[i]) continue; + if (!value_length[i]) continue; status = private_fll_execute_arguments_add_parameter(prefix[i], prefix_length[i], name[i], name_length[i], value[i], value_length[i], arguments); if (F_status_is_error(status)) return status; @@ -68,16 +68,16 @@ extern "C" { #ifndef _di_fll_execute_arguments_add_set_ f_return_status fll_execute_arguments_add_set(const f_string_t source[], const f_string_length_t length[], const f_array_length_t size, f_string_dynamics_t *arguments) { #ifndef _di_level_2_parameter_checking_ - if (arguments == 0) return F_status_set_error(F_parameter); + if (!arguments) return F_status_set_error(F_parameter); if (arguments->used > arguments->size) return F_status_set_error(F_parameter); #endif // _di_level_2_parameter_checking_ - if (size == 0) return F_data_not; + if (!size) return F_data_not; f_status_t status = F_none; for (f_array_length_t i = 0; i < size; i++) { - if (length[i] == 0) continue; + if (!length[i]) continue; status = private_fll_execute_arguments_add(source[i], length[i], arguments); if (F_status_is_error(status)) return status; @@ -91,11 +91,11 @@ extern "C" { f_return_status fll_execute_arguments_dynamic_add(const f_string_static_t source, f_string_dynamics_t *arguments) { #ifndef _di_level_2_parameter_checking_ if (source.used > source.size) return F_status_set_error(F_parameter); - if (arguments == 0) return F_status_set_error(F_parameter); + if (!arguments) return F_status_set_error(F_parameter); if (arguments->used > arguments->size) return F_status_set_error(F_parameter); #endif // _di_level_2_parameter_checking_ - if (source.used == 0) return F_data_not; + if (!source.used) return F_data_not; f_status_t status = F_none; @@ -112,12 +112,12 @@ extern "C" { if (prefix.used > prefix.size) return F_status_set_error(F_parameter); if (name.used > name.size) return F_status_set_error(F_parameter); if (value.used > value.size) return F_status_set_error(F_parameter); - if (arguments == 0) return F_status_set_error(F_parameter); + if (!arguments) return F_status_set_error(F_parameter); if (arguments->used > arguments->size) return F_status_set_error(F_parameter); #endif // _di_level_2_parameter_checking_ - if (name.used == 0) return F_data_not; - if (value.used == 0) return F_data_not; + if (!name.used) return F_data_not; + if (!value.used) return F_data_not; f_status_t status = F_none; @@ -131,19 +131,19 @@ extern "C" { #ifndef _di_fll_execute_arguments_dynamic_add_parameter_set_ f_return_status fll_execute_arguments_dynamic_add_parameter_set(const f_string_static_t prefix[], const f_string_static_t name[], const f_string_static_t value[], const f_array_length_t size, f_string_dynamics_t *arguments) { #ifndef _di_level_2_parameter_checking_ - if (arguments == 0) return F_status_set_error(F_parameter); + if (!arguments) return F_status_set_error(F_parameter); if (arguments->used > arguments->size) return F_status_set_error(F_parameter); #endif // _di_level_2_parameter_checking_ - if (size == 0) return F_data_not; + if (!size) return F_data_not; f_status_t status = F_none; for (f_array_length_t i = 0; i < size; i++) { if (prefix[i].used > prefix[i].size) continue; - if (name[i].used == 0) continue; + if (!name[i].used) continue; if (name[i].used > name[i].size) continue; - if (value[i].used == 0) continue; + if (!value[i].used) continue; if (value[i].used > value[i].size) continue; status = private_fll_execute_arguments_add_parameter(prefix[i].string, prefix[i].used, name[i].string, name[i].used, value[i].string, value[i].used, arguments); @@ -157,16 +157,16 @@ extern "C" { #ifndef _di_fll_execute_arguments_dynamic_add_set_ f_return_status fll_execute_arguments_dynamic_add_set(const f_string_static_t source[], const f_array_length_t size, f_string_dynamics_t *arguments) { #ifndef _di_level_2_parameter_checking_ - if (arguments == 0) return F_status_set_error(F_parameter); + if (!arguments) return F_status_set_error(F_parameter); if (arguments->used > arguments->size) return F_status_set_error(F_parameter); #endif // _di_level_2_parameter_checking_ - if (size == 0) return F_data_not; + if (!size) return F_data_not; f_status_t status = F_none; for (f_array_length_t i = 0; i < size; i++) { - if (source[i].used == 0) continue; + if (!source[i].used) continue; if (source[i].used > source[i].size) continue; status = private_fll_execute_arguments_add(source[i].string, source[i].used, arguments); @@ -180,7 +180,7 @@ extern "C" { #ifndef _di_fll_execute_path_ f_return_status fll_execute_path(const f_string_t program_path, const f_string_statics_t arguments, const f_signal_how_t *signals, int *result) { #ifndef _di_level_2_parameter_checking_ - if (result == 0) return F_status_set_error(F_parameter); + if (!result) return F_status_set_error(F_parameter); if (arguments.used > arguments.size) return F_status_set_error(F_parameter); #endif // _di_level_2_parameter_checking_ @@ -196,7 +196,7 @@ extern "C" { last_slash = strrchr(program_path, '/'); - if (last_slash == 0) { + if (!last_slash) { name_size = strnlen(program_path, f_path_max); if (name_size > 1) { @@ -225,7 +225,7 @@ extern "C" { } } - if (name_size == 0) { + if (!name_size) { fixed_arguments[0] = 0; } else { @@ -265,7 +265,7 @@ extern "C" { } // child process. - if (process_id == 0) { + if (!process_id) { if (signals) { f_signal_set_handle(SIG_BLOCK, &signals->block); f_signal_set_handle(SIG_UNBLOCK, &signals->block_not); @@ -294,7 +294,7 @@ extern "C" { #ifndef _di_fll_execute_path_environment_ f_return_status fll_execute_path_environment(const f_string_t program_path, const f_string_statics_t arguments, const f_signal_how_t *signals, const f_string_statics_t names, const f_string_statics_t values, int *result) { #ifndef _di_level_2_parameter_checking_ - if (result == 0) return F_status_set_error(F_parameter); + if (!result) return F_status_set_error(F_parameter); if (arguments.used > arguments.size) return F_status_set_error(F_parameter); if (names.used > names.size) return F_status_set_error(F_parameter); if (values.used > values.size) return F_status_set_error(F_parameter); @@ -313,7 +313,7 @@ extern "C" { last_slash = strrchr(program_path, '/'); - if (last_slash == 0) { + if (!last_slash) { name_size = strnlen(program_path, f_path_max); if (name_size > 1) { @@ -344,7 +344,7 @@ extern "C" { } } - if (name_size == 0) { + if (!name_size) { fixed_arguments[0] = 0; } else { @@ -382,7 +382,7 @@ extern "C" { } // child process. - if (process_id == 0) { + if (!process_id) { if (signals) { f_signal_set_handle(SIG_BLOCK, &signals->block); f_signal_set_handle(SIG_UNBLOCK, &signals->block_not); @@ -421,7 +421,7 @@ extern "C" { #ifndef _di_fll_execute_program_ f_return_status fll_execute_program(const f_string_t program_name, const f_string_statics_t arguments, const f_signal_how_t *signals, int *result) { #ifndef _di_level_2_parameter_checking_ - if (result == 0) return F_status_set_error(F_parameter); + if (!result) return F_status_set_error(F_parameter); if (arguments.used > arguments.size) return F_status_set_error(F_parameter); #endif // _di_level_2_parameter_checking_ @@ -449,7 +449,7 @@ extern "C" { } // child process. - if (process_id == 0) { + if (!process_id) { if (signals) { f_signal_set_handle(SIG_BLOCK, &signals->block); f_signal_set_handle(SIG_UNBLOCK, &signals->block_not); @@ -474,7 +474,7 @@ extern "C" { #ifndef _di_fll_execute_program_environment_ f_return_status fll_execute_program_environment(const f_string_t program_name, const f_string_statics_t arguments, const f_signal_how_t *signals, const f_string_statics_t names, const f_string_statics_t values, int *result) { #ifndef _di_level_2_parameter_checking_ - if (result == 0) return F_status_set_error(F_parameter); + if (!result) return F_status_set_error(F_parameter); if (arguments.used > arguments.size) return F_status_set_error(F_parameter); if (names.used > names.size) return F_status_set_error(F_parameter); if (values.used > values.size) return F_status_set_error(F_parameter); @@ -566,7 +566,7 @@ extern "C" { } } // for - if (found == 0) { + if (!found) { f_macro_string_dynamics_t_delete_simple(paths); return F_status_set_error(F_file_found_not); } @@ -587,7 +587,7 @@ extern "C" { } // child process. - if (process_id == 0) { + if (!process_id) { if (signals) { f_signal_set_handle(SIG_BLOCK, &signals->block); f_signal_set_handle(SIG_UNBLOCK, &signals->block_not); diff --git a/level_2/fll_fss/c/fss.c b/level_2/fll_fss/c/fss.c index ca8c0d9..9a1ff00 100644 --- a/level_2/fll_fss/c/fss.c +++ b/level_2/fll_fss/c/fss.c @@ -8,8 +8,8 @@ extern "C" { #ifndef _di_fll_fss_identify_ f_return_status fll_fss_identify(const f_string_static_t buffer, f_fss_header_t *header) { #ifndef _di_level_2_parameter_checking_ - if (header == 0) return F_status_set_error(F_parameter); - if (buffer.used == 0) return F_status_set_error(F_parameter); + if (!header) return F_status_set_error(F_parameter); + if (!buffer.used) return F_status_set_error(F_parameter); #endif // _di_level_2_parameter_checking_ return private_fll_fss_identify(buffer, header); @@ -19,9 +19,9 @@ extern "C" { #ifndef _di_fll_fss_identify_file_ f_return_status fll_fss_identify_file(f_file_t *file, f_fss_header_t *header) { #ifndef _di_level_2_parameter_checking_ - if (file == 0) return F_status_set_error(F_parameter); - if (header == 0) return F_status_set_error(F_parameter); - if (file->id == 0) return F_status_set_error(F_file_closed); + if (!file) return F_status_set_error(F_parameter); + if (!header) return F_status_set_error(F_parameter); + if (!file->id) return F_status_set_error(F_file_closed); if (file->id < 0) return F_status_set_error(F_file); #endif // _di_level_2_parameter_checking_ @@ -48,14 +48,14 @@ extern "C" { #ifndef _di_fll_fss_snatch_ f_return_status fll_fss_snatch(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_t names[], const f_string_length_t lengths[], const f_string_length_t size, f_string_dynamic_t *values[], f_array_length_t *indexs[]) { #ifndef _di_level_2_parameter_checking_ - if (size == 0) return F_status_set_error(F_parameter); + if (!size) return F_status_set_error(F_parameter); if (objects.used != contents.used) return F_status_set_error(F_parameter); - if (values == 0) return F_status_set_error(F_parameter); + if (!values) return F_status_set_error(F_parameter); #endif // _di_level_2_parameter_checking_ - if (buffer.used == 0) return F_data_not; - if (objects.used == 0) return F_data_not; - if (contents.used == 0) return F_data_not; + if (!buffer.used) return F_data_not; + if (!objects.used) return F_data_not; + if (!contents.used) return F_data_not; f_status_t status = F_none; f_string_length_t length_object = 0; @@ -100,14 +100,14 @@ extern "C" { #ifndef _di_fll_fss_snatch_apart_ f_return_status fll_fss_snatch_apart(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_t names[], const f_string_length_t lengths[], const f_string_length_t size, f_string_dynamics_t *values[], f_array_lengths_t *indexs[]) { #ifndef _di_level_2_parameter_checking_ - if (size == 0) return F_status_set_error(F_parameter); + if (!size) return F_status_set_error(F_parameter); if (objects.used != contents.used) return F_status_set_error(F_parameter); - if (values == 0) return F_status_set_error(F_parameter); + if (!values) return F_status_set_error(F_parameter); #endif // _di_level_2_parameter_checking_ - if (buffer.used == 0) return F_data_not; - if (objects.used == 0) return F_data_not; - if (contents.used == 0) return F_data_not; + if (!buffer.used) return F_data_not; + if (!objects.used) return F_data_not; + if (!contents.used) return F_data_not; f_status_t status = F_none; f_string_length_t length_object = 0; @@ -168,14 +168,14 @@ extern "C" { #ifndef _di_fll_fss_snatch_map_ f_return_status fll_fss_snatch_map(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_t names[], const f_string_length_t lengths[], const f_string_length_t size, f_string_maps_t *values[], f_array_lengths_t *indexs[]) { #ifndef _di_level_2_parameter_checking_ - if (size == 0) return F_status_set_error(F_parameter); + if (!size) return F_status_set_error(F_parameter); if (objects.used != contents.used) return F_status_set_error(F_parameter); - if (values == 0) return F_status_set_error(F_parameter); + if (!values) return F_status_set_error(F_parameter); #endif // _di_level_2_parameter_checking_ - if (buffer.used == 0) return F_data_not; - if (objects.used == 0) return F_data_not; - if (contents.used == 0) return F_data_not; + if (!buffer.used) return F_data_not; + if (!objects.used) return F_data_not; + if (!contents.used) return F_data_not; f_status_t status = F_none; f_string_length_t length_name = 0; @@ -301,14 +301,14 @@ extern "C" { #ifndef _di_fll_fss_snatch_map_apart_ f_return_status fll_fss_snatch_map_apart(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_t names[], const f_string_length_t lengths[], const f_string_length_t size, f_string_map_multis_t *values[], f_array_lengths_t *indexs[]) { #ifndef _di_level_2_parameter_checking_ - if (size == 0) return F_status_set_error(F_parameter); + if (!size) return F_status_set_error(F_parameter); if (objects.used != contents.used) return F_status_set_error(F_parameter); - if (values == 0) return F_status_set_error(F_parameter); + if (!values) return F_status_set_error(F_parameter); #endif // _di_level_2_parameter_checking_ - if (buffer.used == 0) return F_data_not; - if (objects.used == 0) return F_data_not; - if (contents.used == 0) return F_data_not; + if (!buffer.used) return F_data_not; + if (!objects.used) return F_data_not; + if (!contents.used) return F_data_not; f_status_t status = F_none; f_string_length_t length_object = 0; @@ -394,14 +394,14 @@ extern "C" { #ifndef _di_fll_fss_snatch_map_mash_ f_return_status fll_fss_snatch_map_mash(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_t names[], const f_string_length_t lengths[], const f_string_length_t size, const f_string_t glue, const f_string_length_t glue_length, f_string_maps_t *values[], f_array_lengths_t *indexs[]) { #ifndef _di_level_2_parameter_checking_ - if (size == 0) return F_status_set_error(F_parameter); + if (!size) return F_status_set_error(F_parameter); if (objects.used != contents.used) return F_status_set_error(F_parameter); - if (values == 0) return F_status_set_error(F_parameter); + if (!values) return F_status_set_error(F_parameter); #endif // _di_level_2_parameter_checking_ - if (buffer.used == 0) return F_data_not; - if (objects.used == 0) return F_data_not; - if (contents.used == 0) return F_data_not; + if (!buffer.used) return F_data_not; + if (!objects.used) return F_data_not; + if (!contents.used) return F_data_not; f_status_t status = F_none; f_string_length_t length_object = 0; @@ -478,14 +478,14 @@ extern "C" { #ifndef _di_fll_fss_snatch_map_mash_apart_ f_return_status fll_fss_snatch_map_mash_apart(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_t names[], const f_string_length_t lengths[], const f_string_length_t size, const f_string_t glue, const f_string_length_t glue_length, f_string_map_multis_t *values[], f_array_lengths_t *indexs[]) { #ifndef _di_level_2_parameter_checking_ - if (size == 0) return F_status_set_error(F_parameter); + if (!size) return F_status_set_error(F_parameter); if (objects.used != contents.used) return F_status_set_error(F_parameter); - if (values == 0) return F_status_set_error(F_parameter); + if (!values) return F_status_set_error(F_parameter); #endif // _di_level_2_parameter_checking_ - if (buffer.used == 0) return F_data_not; - if (objects.used == 0) return F_data_not; - if (contents.used == 0) return F_data_not; + if (!buffer.used) return F_data_not; + if (!objects.used) return F_data_not; + if (!contents.used) return F_data_not; f_status_t status = F_none; f_string_length_t length_name = 0; @@ -612,14 +612,14 @@ extern "C" { #ifndef _di_fll_fss_snatch_map_together_ f_return_status fll_fss_snatch_map_together(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_t names[], const f_string_length_t lengths[], const f_string_length_t size, const f_string_t glue, const f_string_length_t glue_length, f_string_maps_t *values[], f_array_lengths_t *indexs[]) { #ifndef _di_level_2_parameter_checking_ - if (size == 0) return F_status_set_error(F_parameter); + if (!size) return F_status_set_error(F_parameter); if (objects.used != contents.used) return F_status_set_error(F_parameter); - if (values == 0) return F_status_set_error(F_parameter); + if (!values) return F_status_set_error(F_parameter); #endif // _di_level_2_parameter_checking_ - if (buffer.used == 0) return F_data_not; - if (objects.used == 0) return F_data_not; - if (contents.used == 0) return F_data_not; + if (!buffer.used) return F_data_not; + if (!objects.used) return F_data_not; + if (!contents.used) return F_data_not; f_status_t status = F_none; f_string_length_t length_name = 0; @@ -747,14 +747,14 @@ extern "C" { #ifndef _di_fll_fss_snatch_mash_ f_return_status fll_fss_snatch_mash(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_t names[], const f_string_length_t lengths[], const f_string_length_t size, const f_string_t glue, const f_string_length_t glue_length, f_string_dynamic_t *values[], f_array_length_t *indexs[]) { #ifndef _di_level_2_parameter_checking_ - if (size == 0) return F_status_set_error(F_parameter); + if (!size) return F_status_set_error(F_parameter); if (objects.used != contents.used) return F_status_set_error(F_parameter); - if (values == 0) return F_status_set_error(F_parameter); + if (!values) return F_status_set_error(F_parameter); #endif // _di_level_2_parameter_checking_ - if (buffer.used == 0) return F_data_not; - if (objects.used == 0) return F_data_not; - if (contents.used == 0) return F_data_not; + if (!buffer.used) return F_data_not; + if (!objects.used) return F_data_not; + if (!contents.used) return F_data_not; f_status_t status = F_none; f_string_length_t length_object = 0; @@ -800,14 +800,14 @@ extern "C" { #ifndef _di_fll_fss_snatch_mash_apart_ f_return_status fll_fss_snatch_mash_apart(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_t names[], const f_string_length_t lengths[], const f_string_length_t size, const f_string_t glue, const f_string_length_t glue_length, f_string_dynamics_t *values[], f_array_lengths_t *indexs[]) { #ifndef _di_level_2_parameter_checking_ - if (size == 0) return F_status_set_error(F_parameter); + if (!size) return F_status_set_error(F_parameter); if (objects.used != contents.used) return F_status_set_error(F_parameter); - if (values == 0) return F_status_set_error(F_parameter); + if (!values) return F_status_set_error(F_parameter); #endif // _di_level_2_parameter_checking_ - if (buffer.used == 0) return F_data_not; - if (objects.used == 0) return F_data_not; - if (contents.used == 0) return F_data_not; + if (!buffer.used) return F_data_not; + if (!objects.used) return F_data_not; + if (!contents.used) return F_data_not; f_status_t status = F_none; f_string_length_t length_object = 0; @@ -874,14 +874,14 @@ extern "C" { #ifndef _di_fll_fss_snatch_together_ f_return_status fll_fss_snatch_together(const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, const f_string_t names[], const f_string_length_t lengths[], const f_string_length_t size, const f_string_t glue, const f_string_length_t glue_length, f_string_dynamic_t *values[], f_array_length_t *indexs[]) { #ifndef _di_level_2_parameter_checking_ - if (size == 0) return F_status_set_error(F_parameter); + if (!size) return F_status_set_error(F_parameter); if (objects.used != contents.used) return F_status_set_error(F_parameter); - if (values == 0) return F_status_set_error(F_parameter); + if (!values) return F_status_set_error(F_parameter); #endif // _di_level_2_parameter_checking_ - if (buffer.used == 0) return F_data_not; - if (objects.used == 0) return F_data_not; - if (contents.used == 0) return F_data_not; + if (!buffer.used) return F_data_not; + if (!objects.used) return F_data_not; + if (!contents.used) return F_data_not; f_status_t status = F_none; f_string_length_t length_object = 0; diff --git a/level_2/fll_fss/c/fss_basic.c b/level_2/fll_fss/c/fss_basic.c index 995bc90..15480e6 100644 --- a/level_2/fll_fss/c/fss_basic.c +++ b/level_2/fll_fss/c/fss_basic.c @@ -7,10 +7,10 @@ extern "C" { #ifndef _di_fll_fss_basic_read_ f_return_status fll_fss_basic_read(f_string_dynamic_t *buffer, f_string_range_t *range, f_fss_objects_t *objects, f_fss_contents_t *contents, f_fss_quoteds_t *quoted_objects) { #ifndef _di_level_2_parameter_checking_ - if (buffer == 0) return F_status_set_error(F_parameter); - if (range == 0) return F_status_set_error(F_parameter); - if (objects == 0) return F_status_set_error(F_parameter); - if (contents == 0) return F_status_set_error(F_parameter); + if (!buffer) return F_status_set_error(F_parameter); + if (!range) return F_status_set_error(F_parameter); + if (!objects) return F_status_set_error(F_parameter); + if (!contents) return F_status_set_error(F_parameter); #endif // _di_level_2_parameter_checking_ f_status_t status = F_none; @@ -157,7 +157,7 @@ extern "C" { #ifndef _di_fll_fss_basic_write_ f_return_status fll_fss_basic_write(const f_string_static_t object, const f_string_statics_t contents, f_string_dynamic_t *destination) { #ifndef _di_level_2_parameter_checking_ - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); if (contents.used > contents.size) return F_status_set_error(F_parameter); #endif // _di_level_2_parameter_checking_ diff --git a/level_2/fll_fss/c/fss_basic_list.c b/level_2/fll_fss/c/fss_basic_list.c index e01d5ff..ddb6495 100644 --- a/level_2/fll_fss/c/fss_basic_list.c +++ b/level_2/fll_fss/c/fss_basic_list.c @@ -7,10 +7,10 @@ extern "C" { #ifndef _di_fll_fss_basic_list_read_ f_return_status fll_fss_basic_list_read(f_string_dynamic_t *buffer, f_string_range_t *range, f_fss_objects_t *objects, f_fss_contents_t *contents) { #ifndef _di_level_2_parameter_checking_ - if (buffer == 0) return F_status_set_error(F_parameter); - if (range == 0) return F_status_set_error(F_parameter); - if (objects == 0) return F_status_set_error(F_parameter); - if (contents == 0) return F_status_set_error(F_parameter); + if (!buffer) return F_status_set_error(F_parameter); + if (!range) return F_status_set_error(F_parameter); + if (!objects) return F_status_set_error(F_parameter); + if (!contents) return F_status_set_error(F_parameter); #endif // _di_level_2_parameter_checking_ f_status_t status = F_none; @@ -136,7 +136,7 @@ extern "C" { #ifndef _di_fll_fss_basic_list_write_ f_return_status fll_fss_basic_list_write(const f_string_static_t object, const f_string_statics_t contents, f_string_dynamic_t *buffer) { #ifndef _di_level_2_parameter_checking_ - if (buffer == 0) return F_status_set_error(F_parameter); + if (!buffer) return F_status_set_error(F_parameter); if (contents.used > contents.size) return F_status_set_error(F_parameter); #endif // _di_level_2_parameter_checking_ diff --git a/level_2/fll_fss/c/fss_extended.c b/level_2/fll_fss/c/fss_extended.c index 513a8c1..a0ce204 100644 --- a/level_2/fll_fss/c/fss_extended.c +++ b/level_2/fll_fss/c/fss_extended.c @@ -7,10 +7,10 @@ extern "C" { #ifndef _di_fll_fss_extended_read_ f_return_status fll_fss_extended_read(f_string_dynamic_t *buffer, f_string_range_t *range, f_fss_objects_t *objects, f_fss_contents_t *contents, f_fss_quoteds_t *quoted_objects, f_fss_quotedss_t *quoted_contents) { #ifndef _di_level_2_parameter_checking_ - if (buffer == 0) return F_status_set_error(F_parameter); - if (range == 0) return F_status_set_error(F_parameter); - if (objects == 0) return F_status_set_error(F_parameter); - if (contents == 0) return F_status_set_error(F_parameter); + if (!buffer) return F_status_set_error(F_parameter); + if (!range) return F_status_set_error(F_parameter); + if (!objects) return F_status_set_error(F_parameter); + if (!contents) return F_status_set_error(F_parameter); #endif // _di_level_2_parameter_checking_ f_status_t status = F_none; @@ -193,7 +193,7 @@ extern "C" { #ifndef _di_fll_fss_extended_write_ f_return_status fll_fss_extended_write(const f_string_static_t object, const f_string_statics_t contents, f_string_dynamic_t *buffer) { #ifndef _di_level_2_parameter_checking_ - if (buffer == 0) return F_status_set_error(F_parameter); + if (!buffer) return F_status_set_error(F_parameter); if (contents.used > contents.size) return F_status_set_error(F_parameter); #endif // _di_level_2_parameter_checking_ diff --git a/level_2/fll_fss/c/fss_extended_list.c b/level_2/fll_fss/c/fss_extended_list.c index 8e699e8..2b93cbf 100644 --- a/level_2/fll_fss/c/fss_extended_list.c +++ b/level_2/fll_fss/c/fss_extended_list.c @@ -7,9 +7,9 @@ extern "C" { #ifndef _di_fll_fss_extended_list_read_ f_return_status fll_fss_extended_list_read(f_string_dynamic_t *buffer, f_string_range_t *range, f_fss_nest_t *nest) { #ifndef _di_level_3_parameter_checking_ - if (buffer == 0) return F_status_set_error(F_parameter); - if (range == 0) return F_status_set_error(F_parameter); - if (nest == 0) return F_status_set_error(F_parameter); + if (!buffer) return F_status_set_error(F_parameter); + if (!range) return F_status_set_error(F_parameter); + if (!nest) return F_status_set_error(F_parameter); #endif // _di_level_3_parameter_checking_ f_status_t status = F_none; @@ -17,7 +17,7 @@ extern "C" { f_string_length_t initial_used = 0; bool found_data = F_false; - if (nest->used == 0) { + if (!nest->used) { f_macro_fss_nest_t_resize(status2, (*nest), f_fss_default_allocation_step); if (F_status_is_error(status2)) return status2; } @@ -115,7 +115,7 @@ extern "C" { #ifndef _di_fll_fss_extended_list_write_ f_return_status fll_fss_extended_list_write(const f_string_static_t object, const f_string_statics_t contents, f_string_dynamic_t *buffer) { #ifndef _di_level_3_parameter_checking_ - if (buffer == 0) return F_status_set_error(F_parameter); + if (!buffer) return F_status_set_error(F_parameter); if (contents.used > contents.size) return F_status_set_error(F_parameter); #endif // _di_level_3_parameter_checking_ diff --git a/level_2/fll_fss/c/fss_status.c b/level_2/fll_fss/c/fss_status.c index 3b08c5b..85c503c 100644 --- a/level_2/fll_fss/c/fss_status.c +++ b/level_2/fll_fss/c/fss_status.c @@ -7,13 +7,13 @@ extern "C" { #ifndef _di_fll_fss_status_from_string_ f_return_status fll_fss_status_from_string(const f_string_t string, f_status_t *code) { #ifndef _di_level_1_parameter_checking_ - if (code == 0) return F_status_set_error(F_parameter); + if (!code) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ f_status_t status = F_none; const f_string_length_t length = strlen(string); - if (length == 0) { + if (!length) { return F_data_not; } @@ -111,7 +111,7 @@ extern "C" { #ifndef _di_fll_fss_status_to_string_ f_return_status fll_fss_status_to_string(const f_status_t code, f_string_t *string) { #ifndef _di_level_2_parameter_checking_ - if (string == 0) return F_status_set_error(F_parameter); + if (!string) return F_status_set_error(F_parameter); #endif // _di_level_2_parameter_checking_ const f_status_t unmasked_code = F_status_set_fine(code); diff --git a/level_2/fll_path/c/path.c b/level_2/fll_path/c/path.c index 040b462..118cd26 100644 --- a/level_2/fll_path/c/path.c +++ b/level_2/fll_path/c/path.c @@ -7,7 +7,7 @@ extern "C" { #ifndef _di_fll_path_canonical_ f_return_status fll_path_canonical(const f_string_t path, f_string_dynamic_t *canonical) { #ifndef _di_level_2_parameter_checking_ - if (canonical == 0) return F_status_set_error(F_parameter); + if (!canonical) return F_status_set_error(F_parameter); #endif // _di_level_2_parameter_checking_ f_status_t status = F_none; diff --git a/level_2/fll_program/c/program.c b/level_2/fll_program/c/program.c index f0b6d24..0746067 100644 --- a/level_2/fll_program/c/program.c +++ b/level_2/fll_program/c/program.c @@ -250,8 +250,8 @@ extern "C" { #ifndef _di_fll_program_parameter_additional_append_ f_return_status fll_program_parameter_additional_append(const f_string_t *argv, const f_string_lengths_t additional, f_string_dynamics_t *destination) { #ifndef _di_level_2_parameter_checking_ - if (argv == 0) return F_status_set_error(F_parameter); - if (destination == 0) return F_status_set_error(F_parameter); + if (!argv) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_2_parameter_checking_ f_status_t status = F_none; @@ -293,9 +293,9 @@ extern "C" { #ifndef _di_fll_program_parameter_additional_mash_ f_return_status fll_program_parameter_additional_mash(const f_string_t glue, const f_string_length_t glue_length, const f_string_t *argv, const f_string_lengths_t additional, f_string_dynamic_t *destination) { #ifndef _di_level_2_parameter_checking_ - if (argv == 0) return F_status_set_error(F_parameter); + if (!argv) return F_status_set_error(F_parameter); if (glue_length < 1) return F_status_set_error(F_parameter); - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_2_parameter_checking_ f_status_t status = F_none; @@ -324,8 +324,8 @@ extern "C" { #ifndef _di_fll_program_parameter_additional_rip_ f_return_status fll_program_parameter_additional_rip(const f_string_t *argv, const f_string_lengths_t additional, f_string_dynamics_t *destination) { #ifndef _di_level_2_parameter_checking_ - if (argv == 0) return F_status_set_error(F_parameter); - if (destination == 0) return F_status_set_error(F_parameter); + if (!argv) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_2_parameter_checking_ f_status_t status = F_none; @@ -368,9 +368,9 @@ extern "C" { #ifndef _di_fll_program_parameter_additional_rip_mash_ f_return_status fll_program_parameter_additional_rip_mash(const f_string_t glue, const f_string_length_t glue_length, const f_string_t *argv, const f_string_lengths_t additional, f_string_dynamic_t *destination) { #ifndef _di_level_2_parameter_checking_ - if (argv == 0) return F_status_set_error(F_parameter); + if (!argv) return F_status_set_error(F_parameter); if (glue_length < 1) return F_status_set_error(F_parameter); - if (destination == 0) return F_status_set_error(F_parameter); + if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_2_parameter_checking_ f_status_t status = F_none; diff --git a/level_2/fll_status/c/status.c b/level_2/fll_status/c/status.c index 7a68545..4a335e0 100644 --- a/level_2/fll_status/c/status.c +++ b/level_2/fll_status/c/status.c @@ -7,13 +7,13 @@ extern "C" { #ifndef _di_fll_status_from_string_ f_return_status fll_status_from_string(const f_string_t string, f_status_t *code) { #ifndef _di_level_1_parameter_checking_ - if (code == 0) return F_status_set_error(F_parameter); + if (!code) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ f_status_t status = F_none; const f_string_length_t length = strlen(string); - if (length == 0) { + if (!length) { return F_data_not; } diff --git a/level_3/byte_dump/c/private-byte_dump.c b/level_3/byte_dump/c/private-byte_dump.c index 0de3a73..65f4153 100644 --- a/level_3/byte_dump/c/private-byte_dump.c +++ b/level_3/byte_dump/c/private-byte_dump.c @@ -65,7 +65,7 @@ extern "C" { } // When width_count == 0, then this is that start of a new character sequence. - if (width_count == 0) { + if (!width_count) { characters.string[character_current] = f_macro_utf_character_t_from_char_1(byte); width_count = 1; @@ -250,7 +250,7 @@ extern "C" { byte = f_macro_utf_character_t_to_char_4(characters.string[character_current]); } - if (cell->column == 0) { + if (!cell->column) { fl_color_print(f_type_output, data.context.set.notable, "%016X ", (uint64_t) cell->row); if (*offset > 0) { @@ -400,7 +400,7 @@ extern "C" { cell->column = 0; cell->row++; - if (bytes == 0) { + if (!bytes) { previous->bytes = 0; previous->invalid = 0; } @@ -510,7 +510,7 @@ extern "C" { } else if (output >= 0 && output <= 32 || output == 127) { if (data.presentation == byte_dump_presentation_normal) { - if (output == 0) { + if (!output) { fl_color_print2(f_type_output, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_null); } else if (output == 1) { diff --git a/level_3/fake/c/private-build.c b/level_3/fake/c/private-build.c index cd380bd..332a303 100644 --- a/level_3/fake/c/private-build.c +++ b/level_3/fake/c/private-build.c @@ -193,7 +193,7 @@ extern "C" { recurse.failures = &failures; for (f_array_length_t i = 0; i < files.used; i++) { - if (files.array[i].used == 0) continue; + if (!files.array[i].used) continue; path_source.used = source.used; @@ -352,7 +352,7 @@ extern "C" { for (uint8_t i = 0; i < 15; i++) { - if (directorys[i]->used == 0) continue; + if (!directorys[i]->used) continue; if (fake_signal_received(data)) { *status = F_status_set_error(F_signal); @@ -383,7 +383,7 @@ extern "C" { #ifndef _di_fake_build_execute_process_script_ void fake_build_execute_process_script(const fake_data_t data, const fake_build_data_t 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) || f_file_exists(file_stage.string) == F_true) return; - if (process_script.used == 0) return; + if (!process_script.used) return; if (fake_signal_received(data)) { *status = F_status_set_error(F_signal); @@ -616,7 +616,7 @@ extern "C" { f_return_status fake_build_get_file_name_without_extension(const fake_data_t data, const f_string_static_t path, f_string_dynamic_t *name) { name->used = 0; - if (path.used == 0) return F_none; + if (!path.used) return F_none; f_status_t status = f_file_name_base(path.string, path.used, name); @@ -1330,7 +1330,7 @@ extern "C" { for (uint8_t i = 0; i < 1; i++) { - if (settings[i]->used == 0) { + if (!settings[i]->used) { fprintf(f_type_error, "%c", f_string_eol[0]); fl_color_print(f_type_error, data.context.set.error, "ERROR: The setting '"); fl_color_print(f_type_error, data.context.set.notable, "%s", names[i]); @@ -1804,7 +1804,7 @@ extern "C" { }; for (f_array_length_t i = 0; i < 26; i++) { - if (settings_single_source[i]->used == 0) continue; + if (!settings_single_source[i]->used) continue; if (settings_single_source[i]->used > 1) { if (data.verbosity == fake_verbosity_verbose) { diff --git a/level_3/fake/c/private-clean.c b/level_3/fake/c/private-clean.c index aef18b1..844bd27 100644 --- a/level_3/fake/c/private-clean.c +++ b/level_3/fake/c/private-clean.c @@ -50,11 +50,11 @@ extern "C" { #if !defined(_di_fake_clean_operate_) int fake_clean_remove_recursively_verbosely(const char *path, const struct stat *file_stat, int type, struct FTW *entity) { - if (entity->level == 0) return 0; + if (!entity->level) return 0; - int result = remove(path); + const int result = remove(path); - if (result == 0) { + if (!result) { printf("Removed '%s'.%c", path, f_string_eol[0]); } diff --git a/level_3/fake/c/private-fake.c b/level_3/fake/c/private-fake.c index fcc7c2f..6f3fb45 100644 --- a/level_3/fake/c/private-fake.c +++ b/level_3/fake/c/private-fake.c @@ -16,7 +16,7 @@ extern "C" { printf("%s", program.string); for (f_array_length_t i = 0; i < arguments.used; i++) { - if (arguments.array[i].used == 0) continue; + if (!arguments.array[i].used) continue; printf(" %s", arguments.array[i].string); } // for @@ -545,7 +545,7 @@ extern "C" { }; for (i = 0; i < 34; i++) { - if (parameters_value[i]->used == 0) continue; + if (!parameters_value[i]->used) continue; status = fl_string_dynamic_terminate_after(parameters_value[i]); diff --git a/level_3/fake/c/private-make.c b/level_3/fake/c/private-make.c index f6f692b..285c1b0 100644 --- a/level_3/fake/c/private-make.c +++ b/level_3/fake/c/private-make.c @@ -1129,7 +1129,7 @@ extern "C" { #ifndef _di_fake_make_operate_expand_ void fake_make_operate_expand(const fake_data_t data, const f_string_range_t section_name, const f_array_length_t operation, const f_string_static_t operation_name, const f_fss_content_t content, const f_fss_quoteds_t quoteds, fake_make_data_t *data_make, f_string_dynamics_t *arguments, f_status_t *status) { if (F_status_is_error(*status)) return; - if (content.used == 0) return; + if (!content.used) return; // pre-allocate the known arguments size. if (arguments->used + content.used > arguments->size) { @@ -2020,7 +2020,7 @@ extern "C" { } } // for - if (operation == 0) { + if (!operation) { fake_print_message_section_operation_unknown(data, data_make->buffer, section->name, section->objects.array[i], data_make->print); *status = F_status_set_error(F_invalid); @@ -2123,7 +2123,7 @@ extern "C" { success = F_false; // break acts identical to fail when at the top of the stack. - if (F_status_set_fine(*status) == F_signal_abort && section_stack->used == 0) { + if (F_status_set_fine(*status) == F_signal_abort && !section_stack->used) { data_make->setting_make.fail = fake_make_operation_fail_type_exit; data_make->print.prefix = fake_make_print_error; data_make->print.context = data.context.set.error; @@ -2139,7 +2139,7 @@ extern "C" { // F_signal_abort is used by the exit section operation. if (F_status_set_fine(*status) == F_signal_quit) { - if (section_stack->used == 0) { + if (!section_stack->used) { *status = F_status_set_error(F_failure); } @@ -2161,7 +2161,7 @@ extern "C" { success = F_true; // F_signal_abort is used by the exit section operation. - if (section_stack->used == 0) { + if (!section_stack->used) { *status = F_none; } @@ -3678,7 +3678,7 @@ extern "C" { printf("%s", program.string); for (f_array_length_t i = 0; i < arguments.used; i++) { - if (arguments.array[i].used == 0) continue; + if (!arguments.array[i].used) continue; printf(" %s", arguments.array[i].string); } // for @@ -3733,7 +3733,7 @@ extern "C" { data_make->setting_make.parameter.array[0].value.array[0].used = 0; - if (return_code == 0) { + if (!return_code) { if (F_status_is_error(*status)) { status2 = fl_string_append("1", 1, &data_make->setting_make.parameter.array[0].value.array[0]); } @@ -3850,7 +3850,7 @@ extern "C" { if (F_status_is_error(*status)) return; if (operation == fake_make_operation_type_index || operation == fake_make_operation_type_run || operation == fake_make_operation_type_shell) { - if (arguments.used == 0) { + if (!arguments.used) { if (data.verbosity != fake_verbosity_quiet && data_make->print.to) { printf("%c", f_string_eol[0]); fl_color_print_line(data_make->print.to, data_make->print.context, "%s: Requires more arguments.", data_make->print.prefix); @@ -4066,7 +4066,7 @@ extern "C" { } if (operation == fake_make_operation_type_compile) { - if (arguments.used == 0) { + if (!arguments.used) { if (data.verbosity != fake_verbosity_quiet && data_make->print.to) { printf("%c", f_string_eol[0]); fl_color_print_line(data_make->print.to, data_make->print.context, "%s: Requires more arguments.", data_make->print.prefix); diff --git a/level_3/fake/c/private-skeleton.c b/level_3/fake/c/private-skeleton.c index 194c1ef..a0ba533 100644 --- a/level_3/fake/c/private-skeleton.c +++ b/level_3/fake/c/private-skeleton.c @@ -160,7 +160,7 @@ extern "C" { f_return_status fake_skeleton_operate_directory_create(const fake_data_t data, const f_string_dynamic_t path) { f_status_t status = F_none; - if (path.used == 0) return F_none; + if (!path.used) return F_none; status = f_directory_exists(path.string); @@ -216,7 +216,7 @@ extern "C" { f_return_status fake_skeleton_operate_file_create(const fake_data_t data, const f_string_dynamic_t path, const bool executable, const f_string_static_t content) { f_status_t status = F_none; - if (path.used == 0) return F_none; + if (!path.used) return F_none; status = f_file_is(path.string, f_file_type_regular, F_false); 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 b513f54..31c47bf 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 @@ -310,7 +310,7 @@ extern "C" { return status; } - if (data->quantity.total == 0) { + if (!data->quantity.total) { status = f_file_size_by_id(file.id, &data->quantity.total); if (F_status_is_error(status)) { fss_basic_list_read_print_file_error(data->context, "f_file_size_by_id", arguments.argv[data->remaining.array[counter]], F_status_set_fine(status)); @@ -323,7 +323,7 @@ extern "C" { } // Skip past empty files. - if (data->quantity.total == 0) { + if (!data->quantity.total) { f_file_close(&file.id); continue; } diff --git a/level_3/fss_basic_list_read/c/private-fss_basic_list_read.c b/level_3/fss_basic_list_read/c/private-fss_basic_list_read.c index 7028c64..05f6fb7 100644 --- a/level_3/fss_basic_list_read/c/private-fss_basic_list_read.c +++ b/level_3/fss_basic_list_read/c/private-fss_basic_list_read.c @@ -114,7 +114,7 @@ extern "C" { f_macro_string_dynamic_t_clear(depths->array[i].value_name); - if (data.parameters[fss_basic_list_read_parameter_depth].additional.used == 0) { + if (!data.parameters[fss_basic_list_read_parameter_depth].additional.used) { position_depth = 0; } else { @@ -201,7 +201,7 @@ extern "C" { return status; } - if (depths->array[i].value_name.used == 0) { + if (!depths->array[i].value_name.used) { fl_color_print(f_type_error, data.context.set.error, "ERROR: The '"); fl_color_print(f_type_error, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_read_long_name); fl_color_print_line(f_type_error, data.context.set.error, "' must not be an empty string."); @@ -388,7 +388,7 @@ extern "C" { f_string_length_t total = 0; for (f_string_length_t i = 0; i < data->objects.used; i++) { - if (names[i] == 0) continue; + if (!names[i]) continue; total++; } // for @@ -429,7 +429,7 @@ extern "C" { } for (f_string_length_t i = 0; i < data->objects.used; i++) { - if (names[i] == 0) continue; + if (!names[i]) continue; print_object(f_type_output, data->buffer, data->objects.array[i]); fprintf(f_type_output, "%c", f_string_eol[0]); @@ -451,17 +451,18 @@ extern "C" { f_array_length_t i = 0; for (; i < data->objects.used; i++) { + if (names[i]) { if (at == depths.array[0].value_at) { if (data->parameters[fss_basic_list_read_parameter_total].result == f_console_result_found) { - if (data->contents.array[i].used == 0) { + if (!data->contents.array[i].used) { fprintf(f_type_output, "0%c", f_string_eol[0]); } else { f_string_length_t total = 1; for (f_string_length_t j = data->contents.array[i].array[0].start; j <= data->contents.array[i].array[0].stop; j++) { - if (data->buffer.string[j] == 0) continue; + if (!data->buffer.string[j]) continue; if (data->buffer.string[j] == f_string_eol[0]) { total++; @@ -475,17 +476,17 @@ extern "C" { } if (data->parameters[fss_basic_list_read_parameter_line].result == f_console_result_additional) { - if (data->contents.array[i].used == 0) { - if (include_empty && line == 0) { + if (!data->contents.array[i].used) { + if (include_empty && !line) { fprintf(f_type_output, "%c", f_string_eol[0]); } } else { f_string_length_t i = data->contents.array[i].array[0].start; - if (line == 0) { + if (!line) { for (; i <= data->contents.array[i].array[0].stop; i++) { - if (data->buffer.string[i] == 0) continue; + if (!data->buffer.string[i]) continue; if (data->buffer.string[i] == f_string_eol[0]) { fprintf(f_type_output, "%c", f_string_eol[0]); break; @@ -498,7 +499,7 @@ extern "C" { f_string_length_t line_current = 0; for (; i <= data->contents.array[i].array[0].stop; i++) { - if (data->buffer.string[i] == 0) continue; + if (!data->buffer.string[i]) continue; if (data->buffer.string[i] == f_string_eol[0]) { line_current++; @@ -507,7 +508,7 @@ extern "C" { i++; for (; i <= data->contents.array[i].array[0].stop; i++) { - if (data->buffer.string[i] == 0) continue; + if (!data->buffer.string[i]) continue; if (data->buffer.string[i] == f_string_eol[0]) { fprintf(f_type_output, "%c", f_string_eol[0]); @@ -550,7 +551,7 @@ extern "C" { for (f_string_length_t i = 0; i < data->objects.used; i++) { if (!names[i]) continue; - if (data->contents.array[i].used == 0) { + if (!data->contents.array[i].used) { if (include_empty) { total++; } @@ -559,7 +560,7 @@ extern "C" { } for (f_string_length_t j = data->contents.array[i].array[0].start; j <= data->contents.array[i].array[0].stop; j++) { - if (data->buffer.string[j] == 0) continue; + if (!data->buffer.string[j]) continue; if (data->buffer.string[j] == f_string_eol[0]) { total++; @@ -579,7 +580,7 @@ extern "C" { for (; i < data->contents.used; i++) { if (!names[i]) continue; - if (data->contents.array[i].used == 0) { + if (!data->contents.array[i].used) { if (include_empty) { if (line_current == line) { fprintf(f_type_output, "%c", f_string_eol[0]); @@ -612,7 +613,7 @@ extern "C" { if (j > data->contents.array[i].array[0].stop) continue; for (; j <= data->contents.array[i].array[0].stop; j++) { - if (data->buffer.string[j] == 0) continue; + if (!data->buffer.string[j]) continue; if (data->buffer.string[j] == f_string_eol[0]) { fprintf(f_type_output, "%c", f_string_eol[0]); @@ -632,7 +633,7 @@ extern "C" { for (f_string_length_t i = 0; i < data->contents.used; i++) { if (!names[i]) continue; - if (data->contents.array[i].used == 0) { + if (!data->contents.array[i].used) { if (include_empty) { fprintf(f_type_output, "%c", f_string_eol[0]); } diff --git a/level_3/fss_basic_list_read/c/private-fss_basic_list_read.h b/level_3/fss_basic_list_read/c/private-fss_basic_list_read.h index 4fdd49c..d27c582 100644 --- a/level_3/fss_basic_list_read/c/private-fss_basic_list_read.h +++ b/level_3/fss_basic_list_read/c/private-fss_basic_list_read.h @@ -104,7 +104,7 @@ extern "C" { depths.used--; \ macro_fss_basic_list_read_depth_t_delete_simple(depths.array[depths.used]); \ } \ - if (depths.used == 0) f_macro_memory_structure_t_delete_simple(depths, fss_basic_list_read_depth_t) + if (!depths.used) f_macro_memory_structure_t_delete_simple(depths, fss_basic_list_read_depth_t) #define macro_fss_basic_list_read_depths_t_destroy_simple(depths) \ depths.used = depths.size; \ @@ -112,7 +112,7 @@ extern "C" { depths.used--; \ macro_fss_basic_list_read_depth_t_destroy_simple(depths.array[depths.used]); \ } \ - if (depths.used == 0) f_macro_memory_structure_t_destroy_simple(depths, fss_basic_list_read_depth_t) + if (!depths.used) f_macro_memory_structure_t_destroy_simple(depths, fss_basic_list_read_depth_t) #define macro_fss_basic_list_read_depths_t_resize(status, depths, new_length) \ status = F_none; \ 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 6ef5401..df6ac9c 100644 --- a/level_3/fss_basic_read/c/fss_basic_read.c +++ b/level_3/fss_basic_read/c/fss_basic_read.c @@ -312,7 +312,7 @@ extern "C" { return status; } - if (data->quantity.total == 0) { + if (!data->quantity.total) { status = f_file_size_by_id(file.id, &data->quantity.total); if (F_status_is_error(status)) { @@ -326,7 +326,7 @@ extern "C" { } // Skip past empty files. - if (data->quantity.total == 0) { + if (!data->quantity.total) { f_file_close(&file.id); continue; } diff --git a/level_3/fss_basic_read/c/private-fss_basic_read.c b/level_3/fss_basic_read/c/private-fss_basic_read.c index 11c6aec..cc7541b 100644 --- a/level_3/fss_basic_read/c/private-fss_basic_read.c +++ b/level_3/fss_basic_read/c/private-fss_basic_read.c @@ -115,7 +115,7 @@ extern "C" { f_macro_string_dynamic_t_clear(depths->array[i].value_name); - if (data.parameters[fss_basic_read_parameter_depth].additional.used == 0) { + if (!data.parameters[fss_basic_read_parameter_depth].additional.used) { position_depth = 0; } else { @@ -204,7 +204,7 @@ extern "C" { return status; } - if (depths->array[i].value_name.used == 0) { + if (!depths->array[i].value_name.used) { fl_color_print(f_type_error, data.context.set.error, "ERROR: The '"); fl_color_print(f_type_error, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_read_long_name); fl_color_print_line(f_type_error, data.context.set.error, "' must not be an empty string."); @@ -393,7 +393,7 @@ extern "C" { f_string_length_t total = 0; for (f_string_length_t i = 0; i < data->objects.used; i++) { - if (names[i] == 0) continue; + if (!names[i]) continue; total++; } // for @@ -434,7 +434,7 @@ extern "C" { } for (f_array_length_t i = 0; i < data->objects.used; i++) { - if (names[i] == 0) continue; + if (!names[i]) continue; print_object(f_type_output, data->buffer, data->objects.array[i]); fprintf(f_type_output, "%c", f_string_eol[0]); @@ -466,7 +466,7 @@ extern "C" { if (names[i]) { if (at == depths.array[0].value_at) { if (data->parameters[fss_basic_read_parameter_total].result == f_console_result_found) { - if (data->contents.array[i].used == 0) { + if (!data->contents.array[i].used) { fprintf(f_type_output, "0%c", f_string_eol[0]); } else { @@ -508,7 +508,7 @@ extern "C" { for (f_string_length_t i = 0; i < data->objects.used; i++) { if (!names[i]) continue; - if (data->contents.array[i].used == 0 && !include_empty) { + if (!data->contents.array[i].used && !include_empty) { continue; } @@ -525,7 +525,7 @@ extern "C" { for (f_string_length_t i = 0; i < data->contents.used; i++) { if (!names[i]) continue; - if (data->contents.array[i].used == 0) { + if (!data->contents.array[i].used) { if (include_empty) { if (line_current == line) { fprintf(f_type_output, "%c", f_string_eol[0]); @@ -554,7 +554,7 @@ extern "C" { for (f_string_length_t i = 0; i < data->contents.used; i++) { if (!names[i]) continue; - if (data->contents.array[i].used == 0) { + if (!data->contents.array[i].used) { if (include_empty) { fprintf(f_type_output, "%c", f_string_eol[0]); } diff --git a/level_3/fss_basic_read/c/private-fss_basic_read.h b/level_3/fss_basic_read/c/private-fss_basic_read.h index a314c07..bbb4cee 100644 --- a/level_3/fss_basic_read/c/private-fss_basic_read.h +++ b/level_3/fss_basic_read/c/private-fss_basic_read.h @@ -104,7 +104,7 @@ extern "C" { depths.used--; \ macro_fss_basic_read_depth_t_delete_simple(depths.array[depths.used]); \ } \ - if (depths.used == 0) f_macro_memory_structure_t_delete_simple(depths, fss_basic_read_depth_t) + if (!depths.used) f_macro_memory_structure_t_delete_simple(depths, fss_basic_read_depth_t) #define macro_fss_basic_read_depths_t_destroy_simple(depths) \ depths.used = depths.size; \ @@ -112,7 +112,7 @@ extern "C" { depths.used--; \ macro_fss_basic_read_depth_t_destroy_simple(depths.array[depths.used]); \ } \ - if (depths.used == 0) f_macro_memory_structure_t_destroy_simple(depths, fss_basic_read_depth_t) + if (!depths.used) f_macro_memory_structure_t_destroy_simple(depths, fss_basic_read_depth_t) #define macro_fss_basic_read_depths_t_resize(status, depths, new_length) \ status = F_none; \ diff --git a/level_3/fss_extended_list_read/c/fss_extended_list_read.c b/level_3/fss_extended_list_read/c/fss_extended_list_read.c index 762d738..625d0da 100644 --- a/level_3/fss_extended_list_read/c/fss_extended_list_read.c +++ b/level_3/fss_extended_list_read/c/fss_extended_list_read.c @@ -297,7 +297,7 @@ extern "C" { return status; } - if (data->quantity.total == 0) { + if (!data->quantity.total) { status = f_file_size_by_id(file.id, &data->quantity.total); if (F_status_is_error(status)) { fss_extended_list_read_print_file_error(data->context, "f_file_size_by_id", arguments.argv[data->remaining.array[counter]], F_status_set_fine(status)); @@ -310,7 +310,7 @@ extern "C" { } // Skip past empty files. - if (data->quantity.total == 0) { + if (!data->quantity.total) { f_file_close(&file.id); continue; } diff --git a/level_3/fss_extended_list_read/c/private-fss_extended_list_read.c b/level_3/fss_extended_list_read/c/private-fss_extended_list_read.c index cb2543b..e8fa198 100644 --- a/level_3/fss_extended_list_read/c/private-fss_extended_list_read.c +++ b/level_3/fss_extended_list_read/c/private-fss_extended_list_read.c @@ -115,7 +115,7 @@ extern "C" { f_macro_string_dynamic_t_clear(depths->array[i].value_name); - if (data.parameters[fss_extended_list_read_parameter_depth].additional.used == 0) { + if (!data.parameters[fss_extended_list_read_parameter_depth].additional.used) { position_depth = 0; } else { @@ -204,7 +204,7 @@ extern "C" { return status; } - if (depths->array[i].value_name.used == 0) { + if (!depths->array[i].value_name.used) { fl_color_print(f_type_error, data.context.set.error, "ERROR: The '"); fl_color_print(f_type_error, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_name); fl_color_print_line(f_type_error, data.context.set.error, "' must not be an empty string."); @@ -414,7 +414,7 @@ extern "C" { f_string_length_t total = 0; for (f_string_length_t i = 0; i < items->used; i++) { - if (names[i] == 0) continue; + if (!names[i]) continue; total++; } // for @@ -472,14 +472,14 @@ extern "C" { if (names[i]) { if (at == depth_setting.value_at) { if (data->parameters[fss_extended_list_read_parameter_total].result == f_console_result_found) { - if (items->array[i].content.used == 0) { + if (!items->array[i].content.used) { fprintf(f_type_output, "0%c", f_string_eol[0]); } else { f_string_length_t total = 1; for (f_string_length_t j = items->array[i].content.array[0].start; j <= items->array[i].content.array[0].stop; j++) { - if (data->buffer.string[j] == 0) continue; + if (!data->buffer.string[j]) continue; if (data->buffer.string[j] == f_string_eol[0]) { total++; @@ -493,18 +493,17 @@ extern "C" { } if (data->parameters[fss_extended_list_read_parameter_line].result == f_console_result_additional) { - if (items->array[i].content.used == 0) { - if (include_empty && line == 0) { + if (!items->array[i].content.used) { + if (include_empty && !line) { fprintf(f_type_output, "%c", f_string_eol[0]); } } else { f_string_length_t i = items->array[i].content.array[0].start; - if (line == 0) { + if (!line) { for (; i <= items->array[i].content.array[0].stop; i++) { - - if (data->buffer.string[i] == 0) continue; + if (!data->buffer.string[i]) continue; if (data->buffer.string[i] == f_string_eol[0]) { fprintf(f_type_output, "%c", f_string_eol[0]); @@ -518,7 +517,7 @@ extern "C" { f_string_length_t line_current = 0; for (; i <= items->array[i].content.array[0].stop; i++) { - if (data->buffer.string[i] == 0) continue; + if (!data->buffer.string[i]) continue; if (data->buffer.string[i] == f_string_eol[0]) { line_current++; @@ -527,8 +526,7 @@ extern "C" { i++; for (; i <= items->array[i].content.array[0].stop; i++) { - - if (data->buffer.string[i] == 0) continue; + if (!data->buffer.string[i]) continue; if (data->buffer.string[i] == f_string_eol[0]) { fprintf(f_type_output, "%c", f_string_eol[0]); @@ -571,7 +569,7 @@ extern "C" { for (f_string_length_t i = 0; i < items->used; i++) { if (!names[i]) continue; - if (items->array[i].content.used == 0) { + if (!items->array[i].content.used) { if (include_empty) { total++; } @@ -580,7 +578,7 @@ extern "C" { } for (f_string_length_t j = items->array[i].content.array[0].start; j <= items->array[i].content.array[0].stop; j++) { - if (data->buffer.string[j] == 0) continue; + if (!data->buffer.string[j]) continue; if (data->buffer.string[j] == f_string_eol[0]) { total++; @@ -600,7 +598,7 @@ extern "C" { for (; i < items->used; i++) { if (!names[i]) continue; - if (items->array[i].content.used == 0) { + if (!items->array[i].content.used) { if (include_empty) { if (line_current == line) { fprintf(f_type_output, "%c", f_string_eol[0]); @@ -632,7 +630,7 @@ extern "C" { if (j > items->array[i].content.array[0].stop) continue; for (; j <= items->array[i].content.array[0].stop; j++) { - if (data->buffer.string[j] == 0) continue; + if (!data->buffer.string[j]) continue; if (data->buffer.string[j] == f_string_eol[0]) { fprintf(f_type_output, "%c", f_string_eol[0]); @@ -652,7 +650,7 @@ extern "C" { for (f_string_length_t i = 0; i < items->used; i++) { if (!names[i]) continue; - if (items->array[i].content.used == 0) { + if (!items->array[i].content.used) { if (include_empty) { fprintf(f_type_output, "%c", f_string_eol[0]); } diff --git a/level_3/fss_extended_list_read/c/private-fss_extended_list_read.h b/level_3/fss_extended_list_read/c/private-fss_extended_list_read.h index caf8413..8d46cd3 100644 --- a/level_3/fss_extended_list_read/c/private-fss_extended_list_read.h +++ b/level_3/fss_extended_list_read/c/private-fss_extended_list_read.h @@ -104,7 +104,7 @@ extern "C" { depths.used--; \ macro_fss_extended_list_read_depth_t_delete_simple(depths.array[depths.used]); \ } \ - if (depths.used == 0) f_macro_memory_structure_t_delete_simple(depths, fss_extended_list_read_depth_t) + if (!depths.used) f_macro_memory_structure_t_delete_simple(depths, fss_extended_list_read_depth_t) #define macro_fss_extended_list_read_depths_t_destroy_simple(depths) \ depths.used = depths.size; \ @@ -112,7 +112,7 @@ extern "C" { depths.used--; \ macro_fss_extended_list_read_depth_t_destroy_simple(depths.array[depths.used]); \ } \ - if (depths.used == 0) f_macro_memory_structure_t_destroy_simple(depths, fss_extended_list_read_depth_t) + if (!depths.used) f_macro_memory_structure_t_destroy_simple(depths, fss_extended_list_read_depth_t) #define macro_fss_extended_list_read_t_depths_resize(status, depths, new_length) \ status = F_none; \ 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 30956c6..51c383e 100644 --- a/level_3/fss_extended_read/c/fss_extended_read.c +++ b/level_3/fss_extended_read/c/fss_extended_read.c @@ -313,7 +313,7 @@ extern "C" { return status; } - if (data->quantity.total == 0) { + if (!data->quantity.total) { status = f_file_size_by_id(file.id, &data->quantity.total); if (F_status_is_error(status)) { @@ -327,7 +327,7 @@ extern "C" { } // Skip past empty files. - if (data->quantity.total == 0) { + if (!data->quantity.total) { f_file_close(&file.id); continue; } diff --git a/level_3/fss_extended_read/c/private-fss_extended_read.c b/level_3/fss_extended_read/c/private-fss_extended_read.c index b3c5966..c090601 100644 --- a/level_3/fss_extended_read/c/private-fss_extended_read.c +++ b/level_3/fss_extended_read/c/private-fss_extended_read.c @@ -114,7 +114,7 @@ extern "C" { f_macro_string_dynamic_t_clear(depths->array[i].value_name); - if (data.parameters[fss_extended_read_parameter_depth].additional.used == 0) { + if (!data.parameters[fss_extended_read_parameter_depth].additional.used) { position_depth = 0; } else { @@ -203,7 +203,7 @@ extern "C" { return status; } - if (depths->array[i].value_name.used == 0) { + if (!depths->array[i].value_name.used) { fl_color_print(f_type_error, data.context.set.error, "ERROR: The '"); fl_color_print(f_type_error, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_read_long_name); fl_color_print_line(f_type_error, data.context.set.error, "' must not be an empty string."); @@ -387,7 +387,7 @@ extern "C" { f_string_length_t total = 0; for (f_string_length_t i = 0; i < data->objects.used; i++) { - if (names[i] == 0) continue; + if (!names[i]) continue; total++; } // for @@ -428,7 +428,7 @@ extern "C" { } for (f_string_length_t i = 0; i < data->objects.used; i++) { - if (names[i] == 0) continue; + if (!names[i]) continue; print_object(f_type_output, data->buffer, data->objects.array[i]); fprintf(f_type_output, "%c", f_string_eol[0]); @@ -454,7 +454,7 @@ extern "C" { if (names[i]) { if (at == depths.array[0].value_at) { if (data->parameters[fss_extended_read_parameter_total].result == f_console_result_found) { - if (data->contents.array[i].used == 0) { + if (!data->contents.array[i].used) { fprintf(f_type_output, "0%c", f_string_eol[0]); } else { @@ -465,7 +465,7 @@ extern "C" { } if (data->parameters[fss_extended_read_parameter_line].result == f_console_result_additional) { - if (line == 0) { + if (!line) { if (data->contents.array[i].used > 0) { f_string_length_t j = 0; @@ -489,7 +489,7 @@ extern "C" { } else if (include_empty) { if (data->parameters[fss_extended_read_parameter_select].result == f_console_result_additional) { - if (select == 0) { + if (!select) { fprintf(f_type_output, "%c", f_string_eol[0]); } } @@ -525,7 +525,7 @@ extern "C" { } else if (include_empty) { if (data->parameters[fss_extended_read_parameter_select].result == f_console_result_additional) { - if (select == 0) { + if (!select) { fprintf(f_type_output, "%c", f_string_eol[0]); } } @@ -552,7 +552,7 @@ extern "C" { continue; } - if (data->contents.array[i].used == 0 && !include_empty) { + if (!data->contents.array[i].used && !include_empty) { continue; } @@ -571,7 +571,7 @@ extern "C" { for (; i < data->contents.used; i++) { if (!names[i]) continue; - if (data->contents.array[i].used == 0) { + if (!data->contents.array[i].used) { if (include_empty) { if (line_current == line) { fprintf(f_type_output, "%c", f_string_eol[0]); @@ -618,8 +618,8 @@ extern "C" { for (; i < data->contents.used; i++) { if (!names[i]) continue; - if (data->contents.array[i].used == 0) { - if (include_empty && select == 0) { + if (!data->contents.array[i].used) { + if (include_empty && !select) { fprintf(f_type_output, "%c", f_string_eol[0]); } diff --git a/level_3/fss_extended_read/c/private-fss_extended_read.h b/level_3/fss_extended_read/c/private-fss_extended_read.h index a8595b6..fd2798f 100644 --- a/level_3/fss_extended_read/c/private-fss_extended_read.h +++ b/level_3/fss_extended_read/c/private-fss_extended_read.h @@ -104,7 +104,7 @@ extern "C" { depths.used--; \ macro_fss_extended_read_depth_t_delete_simple(depths.array[depths.used]); \ } \ - if (depths.used == 0) f_macro_memory_structure_t_delete_simple(depths, fss_extended_read_depth_t) + if (!depths.used) f_macro_memory_structure_t_delete_simple(depths, fss_extended_read_depth_t) #define macro_fss_extended_read_depths_t_destroy_simple(depths) \ depths.used = depths.size; \ @@ -112,7 +112,7 @@ extern "C" { depths.used--; \ macro_fss_extended_read_depth_t_destroy_simple(depths.array[depths.used]); \ } \ - if (depths.used == 0) f_macro_memory_structure_t_destroy_simple(depths, fss_extended_read_depth_t) + if (!depths.used) f_macro_memory_structure_t_destroy_simple(depths, fss_extended_read_depth_t) #define macro_fss_extended_read_depths_t_resize(status, depths, new_length) \ status = F_none; \ diff --git a/level_3/iki_read/c/iki_read.c b/level_3/iki_read/c/iki_read.c index 57df3a4..b98b2b5 100644 --- a/level_3/iki_read/c/iki_read.c +++ b/level_3/iki_read/c/iki_read.c @@ -398,7 +398,7 @@ extern "C" { } // Skip past empty files. - if (total == 0) { + if (!total) { f_file_close(&file.id); continue; } @@ -432,7 +432,7 @@ extern "C" { // ensure a newline is always put at the end of the program execution, unless in quiet mode. if (data->verbosity != iki_read_verbosity_quiet) { - if (F_status_is_error(status) || data->mode == 0) { + if (F_status_is_error(status) || !data->mode) { fprintf(f_type_error, "%c", f_string_eol[0]); } } diff --git a/level_3/iki_read/c/iki_read.h b/level_3/iki_read/c/iki_read.h index 76026d5..fa8e43f 100644 --- a/level_3/iki_read/c/iki_read.h +++ b/level_3/iki_read/c/iki_read.h @@ -181,14 +181,14 @@ extern "C" { while (replacements.used > 0) { \ replacements.used--; \ } \ - if (replacements.used == 0) f_macro_memory_structure_t_delete_simple(replacements, iki_read_substitution_t) + if (!replacements.used) f_macro_memory_structure_t_delete_simple(replacements, iki_read_substitution_t) #define macro_iki_read_substitutions_t_destroy_simple(replacements) \ replacements.used = replacements.size; \ while (replacements.used > 0) { \ replacements.used--; \ } \ - if (replacements.used == 0) f_macro_memory_structure_t_destroy_simple(replacements, iki_read_substitution_t) + if (!replacements.used) f_macro_memory_structure_t_destroy_simple(replacements, iki_read_substitution_t) #define macro_iki_read_substitutions_t_resize(status, replacements, new_length) \ status = F_none; \ -- 1.8.3.1