From d436f61be57aa8392ebde34b0810805bb96fac53 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Fri, 28 Aug 2020 21:47:54 -0500 Subject: [PATCH] Cleanup: fix order of parameters and shorten "seek_to_this". Update the parameters to follow the practice of constants on the left and pointers on the right. Shorten "seek_to_this" to "seek_to". --- level_1/fl_string/c/string.c | 28 ++++++++++++++-------------- level_1/fl_string/c/string.h | 36 ++++++++++++++++++------------------ 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/level_1/fl_string/c/string.c b/level_1/fl_string/c/string.c index be23725..0166e33 100644 --- a/level_1/fl_string/c/string.c +++ b/level_1/fl_string/c/string.c @@ -1475,14 +1475,14 @@ extern "C" { #endif // _di_fl_string_rip_nulless_ #ifndef _di_fl_string_seek_line_to_ - f_return_status fl_string_seek_line_to(const f_string string, f_string_range *range, const int8_t seek_to_this) { + f_return_status fl_string_seek_line_to(const f_string string, const int8_t seek_to, f_string_range *range) { #ifndef _di_level_1_parameter_checking_ if (range == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ if (range->start > range->stop) return F_data_not_stop; - while (string[range->start] != seek_to_this) { + while (string[range->start] != seek_to) { if (string[range->start] == f_string_eol[0]) return F_none_eol; range->start++; @@ -1495,14 +1495,14 @@ extern "C" { #endif // _di_fl_string_seek_line_to_ #ifndef _di_fl_string_seek_line_to_utf_character_ - f_return_status fl_string_seek_line_to_utf_character(const f_string string, f_string_range *range, const f_utf_character seek_to_this) { + f_return_status fl_string_seek_line_to_utf_character(const f_string string, const f_utf_character seek_to, f_string_range *range) { #ifndef _di_level_1_parameter_checking_ if (range == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ if (range->start > range->stop) return F_data_not_stop; - const unsigned short seek_width = f_macro_utf_character_width(seek_to_this); + const unsigned short seek_width = f_macro_utf_character_width(seek_to); f_status status = F_none; @@ -1521,7 +1521,7 @@ extern "C" { if (string[range->start] == f_string_eol[0]) return F_none_eol; if (seek_width == width) { - if (string[range->start] == seek_to_this) return F_none; + if (string[range->start] == seek_to) return F_none; } } // Do not operate on UTF-8 fragments that are not the first byte of the character. @@ -1536,7 +1536,7 @@ extern "C" { status = f_utf_char_to_character(string + range->start, width_max, &character); if (F_status_is_error(status)) return status; - if (character == seek_to_this) return F_none; + if (character == seek_to) return F_none; } } } // for @@ -1546,7 +1546,7 @@ extern "C" { #endif // _di_fl_string_seek_line_to_utf_character_ #ifndef _di_fl_string_seek_line_until_graph_ - f_return_status fl_string_seek_line_until_graph(const f_string string, f_string_range *range, const int8_t placeholder) { + f_return_status fl_string_seek_line_until_graph(const f_string string, const int8_t placeholder, f_string_range *range) { #ifndef _di_level_1_parameter_checking_ if (range == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ @@ -1589,7 +1589,7 @@ extern "C" { #endif // _di_fl_string_seek_line_until_graph_ #ifndef _di_fl_string_seek_line_until_non_graph_ - f_return_status fl_string_seek_line_until_non_graph(const f_string string, f_string_range *range, const int8_t placeholder) { + f_return_status fl_string_seek_line_until_non_graph(const f_string string, const int8_t placeholder, f_string_range *range) { #ifndef _di_level_1_parameter_checking_ if (range == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ @@ -1635,14 +1635,14 @@ extern "C" { #endif // _di_fl_string_seek_line_until_non_graph_ #ifndef _di_fl_string_seek_to_ - f_return_status fl_string_seek_to(const f_string string, f_string_range *range, const int8_t seek_to_this) { + f_return_status fl_string_seek_to(const f_string string, const int8_t seek_to, f_string_range *range) { #ifndef _di_level_1_parameter_checking_ if (range == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ if (range->start > range->stop) return F_data_not_stop; - while (string[range->start] != seek_to_this) { + while (string[range->start] != seek_to) { range->start++; if (range->start > range->stop) return F_none_stop; @@ -1653,14 +1653,14 @@ extern "C" { #endif // _di_fl_string_seek_to_ #ifndef _di_fl_string_seek_to_utf_character_ - f_return_status fl_string_seek_to_utf_character(const f_string string, f_string_range *range, const f_utf_character seek_to_this) { + f_return_status fl_string_seek_to_utf_character(const f_string string, const f_utf_character seek_to, f_string_range *range) { #ifndef _di_level_1_parameter_checking_ if (range == 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ if (range->start > range->stop) return F_data_not_stop; - const unsigned short seek_width = f_macro_utf_character_width(seek_to_this); + const unsigned short seek_width = f_macro_utf_character_width(seek_to); f_status status = F_none; @@ -1677,7 +1677,7 @@ extern "C" { width = 1; if (seek_width == width) { - if (string[range->start] == seek_to_this) return F_none; + if (string[range->start] == seek_to) return F_none; } } // Do not operate on UTF-8 fragments that are not the first byte of the character. @@ -1692,7 +1692,7 @@ extern "C" { status = f_utf_char_to_character(string + range->start, width_max, &character); if (F_status_is_error(status)) return status; - if (character == seek_to_this) return F_none; + if (character == seek_to) return F_none; } } } // for diff --git a/level_1/fl_string/c/string.h b/level_1/fl_string/c/string.h index 8d108d5..d53573e 100644 --- a/level_1/fl_string/c/string.h +++ b/level_1/fl_string/c/string.h @@ -1749,11 +1749,11 @@ extern "C" { * * @param string * The string to traverse. + * @param seek_to + * A single-width character representing a character to seek to. * @param range * A range within the buffer representing the start and stop locations. * The start location will be incremented by seek. - * @param seek_to_this - * A single-width character representing a character to seek to. * * @return * F_none on success. @@ -1763,7 +1763,7 @@ extern "C" { * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_fl_string_seek_line_to_ - extern f_return_status fl_string_seek_line_to(const f_string string, f_string_range *range, const int8_t seek_to_this); + extern f_return_status fl_string_seek_line_to(const f_string string, const int8_t seek_to, f_string_range *range); #endif // _di_fl_string_seek_line_to_ /** @@ -1771,11 +1771,11 @@ extern "C" { * * @param string * The string to traverse. + * @param seek_to + * A 1-width, 2-width, 3-width, or 4-width character representing a character to seek to. * @param range * A range within the buffer representing the start and stop locations. * The start location will be incremented by seek. - * @param seek_to_this - * A 1-width, 2-width, 3-width, or 4-width character representing a character to seek to. * * @return * F_none on success. @@ -1791,7 +1791,7 @@ extern "C" { * @see f_utf_char_to_character() */ #ifndef _di_fl_string_seek_line_to_utf_character_ - extern f_return_status fl_string_seek_line_to_utf_character(const f_string string, f_string_range *range, const f_utf_character seek_to_this); + extern f_return_status fl_string_seek_line_to_utf_character(const f_string string, const f_utf_character seek_to, f_string_range *range); #endif // _di_fl_string_seek_line_to_utf_character_ /** @@ -1799,11 +1799,11 @@ extern "C" { * * @param string * The string to traverse. + * @param placeholder + * A single-width character representing a placeholder to ignore (may be NULL). * @param range * A range within the buffer representing the start and stop locations. * The start location will be incremented by seek. - * @param placeholder - * A single-width character representing a placeholder to ignore (may be NULL). * * @return * F_none on success. @@ -1820,7 +1820,7 @@ extern "C" { * @see f_utf_is_graph() */ #ifndef _di_fl_string_seek_line_until_graph_ - extern f_return_status fl_string_seek_line_until_graph(const f_string string, f_string_range *range, const int8_t placeholder); + extern f_return_status fl_string_seek_line_until_graph(const f_string string, const int8_t placeholder, f_string_range *range); #endif // _di_fl_string_seek_line_until_graph_ /** @@ -1828,11 +1828,11 @@ extern "C" { * * @param string * The string to traverse. + * @param placeholder + * A single-width character representing a placeholder to ignore (may be NULL). * @param range * A range within the buffer representing the start and stop locations. * The start location will be incremented by seek. - * @param placeholder - * A single-width character representing a placeholder to ignore (may be NULL). * * @return * F_none on success. @@ -1850,7 +1850,7 @@ extern "C" { * @see f_utf_is_whitespace() */ #ifndef _di_fl_string_seek_line_until_non_graph_ - extern f_return_status fl_string_seek_line_until_non_graph(const f_string string, f_string_range *range, const int8_t placeholder); + extern f_return_status fl_string_seek_line_until_non_graph(const f_string string, const int8_t placeholder, f_string_range *range); #endif // _di_fl_string_seek_line_until_non_graph_ /** @@ -1858,11 +1858,11 @@ extern "C" { * * @param string * The string to traverse. + * @param seek_to + * A single-width character representing a character to seek to. * @param range * A range within the buffer representing the start and stop locations. * The start location will be incremented by seek. - * @param seek_to_this - * A single-width character representing a character to seek to. * * @return * F_none on success. @@ -1873,7 +1873,7 @@ extern "C" { * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_fl_string_seek_to_ - extern f_return_status fl_string_seek_to(const f_string string, f_string_range *range, const int8_t seek_to_this); + extern f_return_status fl_string_seek_to(const f_string string, const int8_t seek_to, f_string_range *range); #endif // _di_fl_string_seek_to_ /** @@ -1881,11 +1881,11 @@ extern "C" { * * @param string * The string to traverse. + * @param seek_to + * A 1-width, 2-width, 3-width, or 4-width character representing a character to seek to. * @param range * A range within the buffer representing the start and stop locations. * The start location will be incremented by seek. - * @param seek_to_this - * A 1-width, 2-width, 3-width, or 4-width character representing a character to seek to. * * @return * F_none on success. @@ -1901,7 +1901,7 @@ extern "C" { * @see f_utf_char_to_character() */ #ifndef _di_fl_string_seek_to_utf_character_ - extern f_return_status fl_string_seek_to_utf_character(const f_string string, f_string_range *range, const f_utf_character seek_to_this); + extern f_return_status fl_string_seek_to_utf_character(const f_string string, const f_utf_character seek_to, f_string_range *range); #endif // _di_fl_string_seek_to_utf_character_ #ifdef __cplusplus -- 1.8.3.1