From: Kevin Day Date: Wed, 11 Nov 2020 05:37:31 +0000 (-0600) Subject: Update: add fl_string based _increase, _increase_by, _decrease, and decrease_by funct... X-Git-Tag: 0.5.2~81 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=205f97fb1da4a1e2b22fcb8c758880e0963d78c2;p=fll Update: add fl_string based _increase, _increase_by, _decrease, and decrease_by functions. The existing _size_increase() functions are renamed to _increase_by(). The existing _size_decrease() functions are renamed to _decrease_by(). --- diff --git a/level_1/fl_string/c/private-string.c b/level_1/fl_string/c/private-string.c index 387a28a..3e68e22 100644 --- a/level_1/fl_string/c/private-string.c +++ b/level_1/fl_string/c/private-string.c @@ -10,7 +10,7 @@ extern "C" { f_status_t status = F_none; if (destination->used + length > destination->size) { - status = private_fl_string_dynamic_size_increase(length, destination); + status = private_fl_string_dynamic_increase_by(length, destination); if (F_status_is_error(status)) return status; } @@ -38,7 +38,7 @@ extern "C" { size = i - first; if (destination->used + size > destination->size) { - status = private_fl_string_dynamic_size_increase(size, destination); + status = private_fl_string_dynamic_increase_by(size, destination); if (F_status_is_error(status)) return status; } @@ -55,7 +55,7 @@ extern "C" { size = i - first; if (destination->used + size > destination->size) { - status = private_fl_string_dynamic_size_increase(size, destination); + status = private_fl_string_dynamic_increase_by(size, destination); if (F_status_is_error(status)) return status; } @@ -528,8 +528,8 @@ extern "C" { } #endif // !defined(_di_fl_string_compare_trim_) || !defined(_di_fl_string_dynamic_compare_trim_) || !defined(_di_fl_string_dynamic_partial_compare_trim_) -#if !defined(_di_fl_string_dynamic_size_increase_) || !defined(_di_fl_string_append_) || !defined(_di_fl_string_dynamic_append_) || !defined(_di_fl_string_append_mash_) || !defined(_di_fl_string_dynamic_mash_) || !defined(_di_fl_string_append_nulless_) || !defined(_di_fl_string_dynamic_append_nulless_) || !defined(_di_fl_string_mash_nulless_) || !defined(_di_fl_string_dynamic_mash_nulless_) || !defined(_di_fl_string_prepend_) || !defined(_di_fl_string_dynamic_prepend_) || !defined(_di_fl_string_prepend_nulless_) || !defined(_di_fl_string_dynamic_prepend_nulless_) - f_return_status private_fl_string_dynamic_size_increase(const f_string_length_t amount, f_string_dynamic_t *string) { +#if !defined(_di_fl_string_dynamic_increase_by_) || !defined(_di_fl_string_append_) || !defined(_di_fl_string_dynamic_append_) || !defined(_di_fl_string_append_mash_) || !defined(_di_fl_string_dynamic_mash_) || !defined(_di_fl_string_append_nulless_) || !defined(_di_fl_string_dynamic_append_nulless_) || !defined(_di_fl_string_mash_nulless_) || !defined(_di_fl_string_dynamic_mash_nulless_) || !defined(_di_fl_string_prepend_) || !defined(_di_fl_string_dynamic_prepend_) || !defined(_di_fl_string_prepend_nulless_) || !defined(_di_fl_string_dynamic_prepend_nulless_) + f_return_status private_fl_string_dynamic_increase_by(const f_string_length_t amount, f_string_dynamic_t *string) { f_status_t status = F_none; if (string->size + amount > f_string_length_t_size) { @@ -544,7 +544,7 @@ extern "C" { f_macro_string_dynamic_t_resize(status, (*string), string->size + amount); return status; } -#endif // !defined(_di_fl_string_dynamic_size_increase_) || !defined(_di_fl_string_append_) || !defined(_di_fl_string_dynamic_append_) || !defined(_di_fl_string_append_mash_) || !defined(_di_fl_string_dynamic_mash_) || !defined(_di_fl_string_append_nulless_) || !defined(_di_fl_string_dynamic_append_nulless_) || !defined(_di_fl_string_mash_nulless_) || !defined(_di_fl_string_dynamic_mash_nulless_) || !defined(_di_fl_string_prepend_) || !defined(_di_fl_string_dynamic_prepend_) || !defined(_di_fl_string_prepend_nulless_) || !defined(_di_fl_string_dynamic_prepend_nulless_) +#endif // !defined(_di_fl_string_dynamic_increase_by_) || !defined(_di_fl_string_append_) || !defined(_di_fl_string_dynamic_append_) || !defined(_di_fl_string_append_mash_) || !defined(_di_fl_string_dynamic_mash_) || !defined(_di_fl_string_append_nulless_) || !defined(_di_fl_string_dynamic_append_nulless_) || !defined(_di_fl_string_mash_nulless_) || !defined(_di_fl_string_dynamic_mash_nulless_) || !defined(_di_fl_string_prepend_) || !defined(_di_fl_string_dynamic_prepend_) || !defined(_di_fl_string_prepend_nulless_) || !defined(_di_fl_string_dynamic_prepend_nulless_) #if !defined(_di_fl_string_prepend_) || !defined(_di_fl_string_dynamic_prepend_) || !defined(_di_fl_string_append_mish_) || !defined(_di_fl_string_dynamic_mish_) f_return_status private_fl_string_prepend(const f_string_t source, const f_string_length_t length, f_string_dynamic_t *destination) { @@ -556,7 +556,7 @@ extern "C" { f_status_t status = F_none; if (destination->used + length > destination->size) { - status = private_fl_string_dynamic_size_increase(length, destination); + status = private_fl_string_dynamic_increase_by(length, destination); if (F_status_is_error(status)) return status; } @@ -594,7 +594,7 @@ extern "C" { size = i - first; if (destination->used + size > destination->size) { - status = private_fl_string_dynamic_size_increase(size, destination); + status = private_fl_string_dynamic_increase_by(size, destination); if (F_status_is_error(status)) return status; } @@ -614,7 +614,7 @@ extern "C" { size = i - first; if (destination->used + size > destination->size) { - status = private_fl_string_dynamic_size_increase(size, destination); + status = private_fl_string_dynamic_increase_by(size, destination); if (F_status_is_error(status)) return status; } diff --git a/level_1/fl_string/c/private-string.h b/level_1/fl_string/c/private-string.h index 824bd90..cbe08d7 100644 --- a/level_1/fl_string/c/private-string.h +++ b/level_1/fl_string/c/private-string.h @@ -214,12 +214,12 @@ extern "C" { #endif // !defined(_di_fl_string_compare_trim_) || !defined(_di_fl_string_dynamic_compare_trim_) || !defined(_di_fl_string_dynamic_partial_compare_trim_) /** - * Private implementation of fl_string_dynamic_size_increase(). + * Private implementation of fl_string_dynamic_increase_by(). * * Intended to be shared to each of the different implementation variations. * * @param amount - * A positive number greater than 0 representing how much to increase the size by. + * A positive number representing how much to increase the size by. * @param string * The string to resize. * @@ -231,9 +231,9 @@ extern "C" { * F_parameter (with error bit) if a parameter is invalid. * F_string_too_large (with error bit) if the combined string is too large. */ -#if !defined(_di_fl_string_dynamic_size_increase_) || !defined(_di_fl_string_append_) || !defined(_di_fl_string_dynamic_append_) || !defined(_di_fl_string_append_mash_) || !defined(_di_fl_string_dynamic_mash_) || !defined(_di_fl_string_append_nulless_) || !defined(_di_fl_string_dynamic_append_nulless_) || !defined(_di_fl_string_mash_nulless_) || !defined(_di_fl_string_dynamic_mash_nulless_) || !defined(_di_fl_string_prepend_) || !defined(_di_fl_string_dynamic_prepend_) || !defined(_di_fl_string_prepend_nulless_) || !defined(_di_fl_string_dynamic_prepend_nulless_) - extern f_return_status private_fl_string_dynamic_size_increase(const f_string_length_t amount, f_string_dynamic_t *string) f_gcc_attribute_visibility_internal; -#endif // !defined(_di_fl_string_dynamic_size_increase_) || !defined(_di_fl_string_append_) || !defined(_di_fl_string_dynamic_append_) || !defined(_di_fl_string_append_mash_) || !defined(_di_fl_string_dynamic_mash_) || !defined(_di_fl_string_append_nulless_) || !defined(_di_fl_string_dynamic_append_nulless_) || !defined(_di_fl_string_mash_nulless_) || !defined(_di_fl_string_dynamic_mash_nulless_) || !defined(_di_fl_string_prepend_) || !defined(_di_fl_string_dynamic_prepend_) || !defined(_di_fl_string_prepend_nulless_) || !defined(_di_fl_string_dynamic_prepend_nulless_) +#if !defined(_di_fl_string_dynamic_increase_by_) || !defined(_di_fl_string_append_) || !defined(_di_fl_string_dynamic_append_) || !defined(_di_fl_string_append_mash_) || !defined(_di_fl_string_dynamic_mash_) || !defined(_di_fl_string_append_nulless_) || !defined(_di_fl_string_dynamic_append_nulless_) || !defined(_di_fl_string_mash_nulless_) || !defined(_di_fl_string_dynamic_mash_nulless_) || !defined(_di_fl_string_prepend_) || !defined(_di_fl_string_dynamic_prepend_) || !defined(_di_fl_string_prepend_nulless_) || !defined(_di_fl_string_dynamic_prepend_nulless_) + extern f_return_status private_fl_string_dynamic_increase_by(const f_string_length_t amount, f_string_dynamic_t *string) f_gcc_attribute_visibility_internal; +#endif // !defined(_di_fl_string_dynamic_increase_by_) || !defined(_di_fl_string_append_) || !defined(_di_fl_string_dynamic_append_) || !defined(_di_fl_string_append_mash_) || !defined(_di_fl_string_dynamic_mash_) || !defined(_di_fl_string_append_nulless_) || !defined(_di_fl_string_dynamic_append_nulless_) || !defined(_di_fl_string_mash_nulless_) || !defined(_di_fl_string_dynamic_mash_nulless_) || !defined(_di_fl_string_prepend_) || !defined(_di_fl_string_dynamic_prepend_) || !defined(_di_fl_string_prepend_nulless_) || !defined(_di_fl_string_dynamic_prepend_nulless_) /** * Private implementation of fl_string_prepend(). diff --git a/level_1/fl_string/c/string.c b/level_1/fl_string/c/string.c index 0f6816c..92bb133 100644 --- a/level_1/fl_string/c/string.c +++ b/level_1/fl_string/c/string.c @@ -892,8 +892,27 @@ extern "C" { } #endif // _di_fl_string_dynamic_rip_nulless_ -#ifndef _di_fl_string_dynamic_size_decrease_ - f_return_status fl_string_dynamic_size_decrease(const f_string_length_t amount, f_string_dynamic_t *string) { +#ifndef _di_fl_string_dynamic_decrease_ + f_return_status fl_string_dynamic_decrease(f_string_dynamic_t *string) { + #ifndef _di_level_1_parameter_checking_ + if (!string) return F_status_set_error(F_parameter); + #endif // _di_level_1_parameter_checking_ + + f_status_t status = F_none; + + if (string->size - 1 > 0) { + f_macro_string_dynamic_t_resize(status, (*string), string->size - 1); + } + else { + f_macro_string_dynamic_t_delete(status, (*string)); + } + + return status; + } +#endif // _di_fl_string_dynamic_decrease_ + +#ifndef _di_fl_string_dynamic_decrease_by_ + f_return_status fl_string_dynamic_decrease_by(const f_string_length_t amount, f_string_dynamic_t *string) { #ifndef _di_level_1_parameter_checking_ if (!amount) return F_status_set_error(F_parameter); if (!string) return F_status_set_error(F_parameter); @@ -904,24 +923,46 @@ extern "C" { if (string->size - amount > 0) { f_macro_string_dynamic_t_resize(status, (*string), string->size - amount); } - else if (string->size - amount <= 0) { + else { f_macro_string_dynamic_t_delete(status, (*string)); } return status; } -#endif // _di_fl_string_dynamic_size_decrease_ +#endif // _di_fl_string_dynamic_decrease_by_ + +#ifndef _di_fl_string_dynamic_increase_ + f_return_status fl_string_dynamic_increase(f_string_dynamic_t *string) { + #ifndef _di_level_1_parameter_checking_ + if (!string) return F_status_set_error(F_parameter); + #endif // _di_level_1_parameter_checking_ + + f_status_t status = F_none; + + if (string->size + f_memory_default_allocation_step > f_string_length_t_size) { + if (string->size == f_string_length_t_size) { + return F_status_set_error(F_string_too_large); + } + + f_macro_string_dynamic_t_resize(status, (*string), f_string_length_t_size); + return F_string_too_large; + } + + f_macro_string_dynamic_t_resize(status, (*string), string->size + f_memory_default_allocation_step); + return status; + } +#endif // _di_fl_string_dynamic_increase_ -#ifndef _di_fl_string_dynamic_size_increase_ - f_return_status fl_string_dynamic_size_increase(const f_string_length_t amount, f_string_dynamic_t *string) { +#ifndef _di_fl_string_dynamic_increase_by_ + f_return_status fl_string_dynamic_increase_by(const f_string_length_t amount, f_string_dynamic_t *string) { #ifndef _di_level_1_parameter_checking_ if (!amount) 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(amount, string); + return private_fl_string_dynamic_increase_by(amount, string); } -#endif // _di_fl_string_dynamic_size_increase_ +#endif // _di_fl_string_dynamic_increase_by_ #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) { @@ -1246,95 +1287,173 @@ extern "C" { } #endif // _di_fl_string_dynamic_terminate_after_ -#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_fl_string_dynamics_decrease_ + f_return_status fl_string_dynamics_decrease(f_string_dynamics_t *strings) { #ifndef _di_level_1_parameter_checking_ - 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; - if (strings->size - length > 0) { - f_macro_string_dynamics_t_resize(status, (*strings), strings->size - length); + if (strings->size - 1 > 0) { + f_macro_string_dynamics_t_resize(status, (*strings), strings->size - 1); } - else if (strings->size - length <= 0) { + else { f_macro_string_dynamics_t_delete(status, (*strings)); } return status; } -#endif // _di_fl_string_dynamics_size_decrease_ +#endif // _di_fl_string_dynamics_decrease_ -#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_fl_string_dynamics_decrease_by_ + f_return_status fl_string_dynamics_decrease_by(const f_array_length_t amount, f_string_dynamics_t *strings) { #ifndef _di_level_1_parameter_checking_ - if (!length) return F_status_set_error(F_parameter); + if (!amount) 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; - if (strings->size + length > f_array_length_t_size) { + if (strings->size - amount > 0) { + f_macro_string_dynamics_t_resize(status, (*strings), strings->size - amount); + } + else { + f_macro_string_dynamics_t_delete(status, (*strings)); + } + + return status; + } +#endif // _di_fl_string_dynamics_decrease_by_ + +#ifndef _di_fl_string_dynamics_increase_ + f_return_status fl_string_dynamics_increase(f_string_dynamics_t *strings) { + #ifndef _di_level_1_parameter_checking_ + if (!strings) return F_status_set_error(F_parameter); + #endif // _di_level_1_parameter_checking_ + + f_status_t status = F_none; + + if (strings->size + f_memory_default_allocation_step > f_array_length_t_size) { if (strings->size == f_array_length_t_size) { - return F_status_set_error(F_string_too_large); + return F_status_set_error(F_buffer_too_large); } f_macro_string_dynamics_t_resize(status, (*strings), f_array_length_t_size); - return F_string_too_large; + return F_buffer_too_large; } - f_macro_string_dynamics_t_resize(status, (*strings), strings->size + length); + f_macro_string_dynamics_t_resize(status, (*strings), strings->size + f_memory_default_allocation_step); return status; } -#endif // _di_fl_string_dynamics_size_increase_ +#endif // _di_fl_string_dynamics_increase_ -#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_fl_string_dynamics_increase_by_ + f_return_status fl_string_dynamics_increase_by(const f_array_length_t amount, f_string_dynamics_t *strings) { + #ifndef _di_level_1_parameter_checking_ + if (!amount) 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; + + if (strings->size + amount > f_array_length_t_size) { + if (strings->size == f_array_length_t_size) { + return F_status_set_error(F_buffer_too_large); + } + + f_macro_string_dynamics_t_resize(status, (*strings), f_array_length_t_size); + return F_buffer_too_large; + } + + f_macro_string_dynamics_t_resize(status, (*strings), strings->size + amount); + return status; + } +#endif // _di_fl_string_dynamics_increase_by_ + +#ifndef _di_fl_string_lengths_decrease_ + f_return_status fl_string_lengths_decrease(f_string_lengths_t *lengths) { #ifndef _di_level_1_parameter_checking_ - 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; - if (lengths->used - length > 0) { - f_macro_string_lengths_t_resize(status, (*lengths), lengths->size - length); + if (lengths->size - 1 > 0) { + f_macro_string_lengths_t_resize(status, (*lengths), lengths->size - 1); } - else if (lengths->used - length <= 0) { + else { f_macro_string_lengths_t_delete(status, (*lengths)); } return status; } -#endif // _di_fl_string_lengths_size_decrease_ +#endif // _di_fl_string_lengths_decrease_ -#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_fl_string_lengths_decrease_by_ + f_return_status fl_string_lengths_decrease_by(const f_array_length_t amount, f_string_lengths_t *lengths) { #ifndef _di_level_1_parameter_checking_ - if (!length) return F_status_set_error(F_parameter); + if (!amount) 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; - if (lengths->used + length > lengths->size) { - if (lengths->used + length > f_array_length_t_size) { - if (lengths->used == f_array_length_t_size) { - status = F_status_set_error(F_string_too_large); - } - else { - f_macro_string_lengths_t_resize(status, (*lengths), f_array_length_t_size); - } + if (lengths->size - amount > 0) { + f_macro_string_lengths_t_resize(status, (*lengths), lengths->size - amount); + } + else { + f_macro_string_lengths_t_delete(status, (*lengths)); + } + + return status; + } +#endif // _di_fl_string_lengths_decrease_by_ + +#ifndef _di_fl_string_lengths_increase_ + f_return_status fl_string_lengths_increase(f_string_lengths_t *lengths) { + #ifndef _di_level_1_parameter_checking_ + if (!lengths) return F_status_set_error(F_parameter); + #endif // _di_level_1_parameter_checking_ + + f_status_t status = F_none; + + if (lengths->size + f_memory_default_allocation_step > f_array_length_t_size) { + if (lengths->size == f_array_length_t_size) { + return F_status_set_error(F_buffer_too_large); } - else { - f_macro_string_lengths_t_resize(status, (*lengths), lengths->size + length); + + f_macro_string_lengths_t_resize(status, (*lengths), f_array_length_t_size); + return F_buffer_too_large; + } + + f_macro_string_lengths_t_resize(status, (*lengths), lengths->size + f_memory_default_allocation_step); + return status; + } +#endif // _di_fl_string_lengths_increase_ + +#ifndef _di_fl_string_lengths_increase_by_ + f_return_status fl_string_lengths_increase_by(const f_array_length_t amount, f_string_lengths_t *lengths) { + #ifndef _di_level_1_parameter_checking_ + if (!amount) 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; + + if (lengths->size + amount > f_array_length_t_size) { + if (lengths->size == f_array_length_t_size) { + return F_status_set_error(F_buffer_too_large); } + + f_macro_string_lengths_t_resize(status, (*lengths), f_array_length_t_size); + return F_buffer_too_large; } + f_macro_string_lengths_t_resize(status, (*lengths), lengths->size + amount); return status; } -#endif // _di_fl_string_lengths_size_increase_ +#endif // _di_fl_string_lengths_increase_by_ #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) { diff --git a/level_1/fl_string/c/string.h b/level_1/fl_string/c/string.h index c157dc2..fdc8ab2 100644 --- a/level_1/fl_string/c/string.h +++ b/level_1/fl_string/c/string.h @@ -1509,27 +1509,69 @@ extern "C" { #endif // _di_fl_string_dynamic_rip_nulless_ /** + * Resize the dynamic string to a smaller size, by 1. + * + * This will shrink the size by size - 1. + * This will not shrink the size to less than 0. + * + * @param string + * The string to resize. + * + * @return + * F_none on success. + * F_memory_allocation (with error bit) on memory allocation error. + * F_memory_reallocation (with error bit) on memory reallocation error. + * F_parameter (with error bit) if a parameter is invalid. + */ +#ifndef _di_fl_string_dynamic_decrease_ + extern f_return_status fl_string_dynamic_decrease(f_string_dynamic_t *string); +#endif // _di_fl_string_dynamic_decrease_ + +/** * Resize the dynamic string to a smaller size. * - * This will resize making the string smaller based on the given length. + * This will resize making the string smaller based on (size - given length). * If the given length is too small, then the resize will fail. * This will not shrink the size to less than 0. * * @param amount - * A positive number greater than 0 representing how much to decrease the size by. + * A positive number representing how much to decrease the size by. + * @param string + * The string to resize. + * + * @return + * F_none on success. + * F_memory_allocation (with error bit) on memory allocation error. + * F_memory_reallocation (with error bit) on memory reallocation error. + * F_parameter (with error bit) if a parameter is invalid. + */ +#ifndef _di_fl_string_dynamic_decrease_by_ + extern f_return_status fl_string_dynamic_decrease_by(const f_string_length_t amount, f_string_dynamic_t *string); +#endif // _di_fl_string_dynamic_decrease_by_ + +/** + * Resize the dynamic string to a larger size. + * + * This will resize making the string larger based on the given length. + * If the given length is too large for the buffer, then attempt to set max buffer size (f_string_length_t_size). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param amount + * A positive number representing how much to increase the size by. * @param string * The string to resize. * * @return * F_none on success. + * F_string_too_large on success, but the requested length is too large for the buffer. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. * F_parameter (with error bit) if a parameter is invalid. * F_string_too_large (with error bit) if the combined string is too large. */ -#ifndef _di_fl_string_dynamic_size_decrease_ - extern f_return_status fl_string_dynamic_size_decrease(const f_string_length_t amount, f_string_dynamic_t *string); -#endif // _di_fl_string_dynamic_size_decrease_ +#ifndef _di_fl_string_dynamic_increase_ + extern f_return_status fl_string_dynamic_increase(f_string_dynamic_t *string); +#endif // _di_fl_string_dynamic_increase_ /** * Resize the dynamic string to a larger size. @@ -1539,7 +1581,7 @@ extern "C" { * If already set to the maximum buffer size, then the resize will fail. * * @param amount - * A positive number greater than 0 representing how much to increase the size by. + * A positive number representing how much to increase the size by. * @param string * The string to resize. * @@ -1551,9 +1593,9 @@ extern "C" { * F_parameter (with error bit) if a parameter is invalid. * F_string_too_large (with error bit) if the combined string is too large. */ -#ifndef _di_fl_string_dynamic_size_increase_ - extern f_return_status fl_string_dynamic_size_increase(const f_string_length_t amount, f_string_dynamic_t *string); -#endif // _di_fl_string_dynamic_size_increase_ +#ifndef _di_fl_string_dynamic_increase_by_ + extern f_return_status fl_string_dynamic_increase_by(const f_string_length_t amount, f_string_dynamic_t *string); +#endif // _di_fl_string_dynamic_increase_by_ /** * Seek the buffer location forward until EOL is reached. @@ -1786,14 +1828,33 @@ extern "C" { #endif // _di_fl_string_dynamic_terminate_after_ /** - * Resize the array of dynamic strings to a smaller size. + * Resize the dynamic string array to a smaller size, by 1. + * + * This will shrink the size by size - 1. + * This will not shrink the size to less than 0. + * + * @param strings + * The string array to resize. + * + * @return + * F_none on success. + * F_memory_allocation (with error bit) on memory allocation error. + * F_memory_reallocation (with error bit) on memory reallocation error. + * F_parameter (with error bit) if a parameter is invalid. + */ +#ifndef _di_fl_string_dynamics_decrease_ + extern f_return_status fl_string_dynamics_decrease(f_string_dynamics_t *strings); +#endif // _di_fl_string_dynamics_decrease_ + +/** + * Resize the dynamic string array to a smaller size. * - * This will resize making the string smaller based on the given length. + * This will resize making the array smaller based on (size - given length). * If the given length is too small, then the resize will fail. * This will not shrink the size to less than 0. * - * @param length - * A positive number greater than 0 representing how much to decrease the size by. + * @param amount + * A positive number representing how much to decrease the size by. * @param strings * The string array to resize. * @@ -1802,81 +1863,141 @@ extern "C" { * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. * F_parameter (with error bit) if a parameter is invalid. - * F_string_too_large (with error bit) if the combined string is too large. */ -#ifndef _di_fl_string_dynamics_size_decrease_ - extern f_return_status fl_string_dynamics_size_decrease(const f_array_length_t length, f_string_dynamics_t *strings); -#endif // _di_fl_string_dynamics_size_decrease_ +#ifndef _di_fl_string_dynamics_decrease_by_ + extern f_return_status fl_string_dynamics_decrease_by(const f_array_length_t amount, f_string_dynamics_t *strings); +#endif // _di_fl_string_dynamics_decrease_by_ + +/** + * Increase the size of the dynamic string array, but only if necessary. + * + * If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param strings + * The string array to resize. + * + * @return + * F_none on success. + * F_buffer_too_large on success, but the requested length is too large for the buffer. + * F_memory_allocation (with error bit) on memory allocation error. + * F_memory_reallocation (with error bit) on memory reallocation error. + * F_parameter (with error bit) if a parameter is invalid. + * F_buffer_too_large (with error bit) if the new array length is too large. + */ +#ifndef _di_fl_string_dynamics_increase_ + extern f_return_status fl_string_dynamics_increase(f_string_dynamics_t *strings); +#endif // _di_fl_string_dynamics_increase_ /** - * Resize the array of dynamic strings to a larger size. + * Resize the dynamic string array to a larger size. * * This will resize making the string larger based on the given length. * If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size). * If already set to the maximum buffer size, then the resize will fail. * - * @param length - * A positive number greater than 0 representing how much to increase the size by. + * @param amount + * A positive number representing how much to increase the size by. * @param strings * The string array to resize. * * @return * F_none on success. - * F_string_too_large on success, but the requested length is too large for the buffer. + * F_buffer_too_large on success, but the requested length is too large for the buffer. + * F_memory_allocation (with error bit) on memory allocation error. + * F_memory_reallocation (with error bit) on memory reallocation error. + * F_parameter (with error bit) if a parameter is invalid. + * F_buffer_too_large (with error bit) if the new array length is too large. + */ +#ifndef _di_fl_string_dynamics_increase_by_ + extern f_return_status fl_string_dynamics_increase_by(const f_array_length_t amount, f_string_dynamics_t *strings); +#endif // _di_fl_string_dynamics_increase_by_ + +/** + * Resize the string lengths array to a smaller size, by 1. + * + * This will shrink the size by size - 1. + * This will not shrink the size to less than 0. + * + * @param lengths + * The string lengths array to resize. + * + * @return + * F_none on success. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. * F_parameter (with error bit) if a parameter is invalid. - * F_string_too_large (with error bit) if the combined string is too large. */ -#ifndef _di_fl_string_dynamics_size_increase_ - extern f_return_status fl_string_dynamics_size_increase(const f_array_length_t length, f_string_dynamics_t *strings); -#endif // _di_fl_string_dynamics_size_increase_ +#ifndef _di_fl_string_lengths_decrease_ + extern f_return_status fl_string_lengths_decrease(f_string_lengths_t *lengths); +#endif // _di_fl_string_lengths_decrease_ /** - * Resize the array of string lengths to a smaller size. + * Resize the string lengths array to a smaller size. * - * This will resize making the string smaller based on the given length. + * This will resize making the array smaller based on (size - given length). * If the given length is too small, then the resize will fail. * This will not shrink the size to less than 0. * - * @param length - * A positive number greater than 0 representing how much to decrease the size by. - * @param strings - * The string array to resize. + * @param amount + * A positive number representing how much to decrease the size by. + * @param lengths + * The string lengths array to resize. * * @return * F_none on success. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. * F_parameter (with error bit) if a parameter is invalid. - * F_string_too_large (with error bit) if the combined string is too large. */ -#ifndef _di_fl_string_lengths_size_decrease_ - extern f_return_status fl_string_length_size_decrease(const f_array_length_t length, f_string_lengths_t *lengths); -#endif // _di_fl_string_lengths_size_decrease_ +#ifndef _di_fl_string_lengths_decrease_by_ + extern f_return_status fl_string_lengths_decrease_by(const f_array_length_t amount, f_string_lengths_t *lengths); +#endif // _di_fl_string_lengths_decrease_by_ + +/** + * Increase the size of the string lengths array, but only if necessary. + * + * If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size). + * If already set to the maximum buffer size, then the resize will fail. + * + * @param lengths + * The string lengths array to resize. + * + * @return + * F_none on success. + * F_buffer_too_large on success, but the requested length is too large for the buffer. + * F_memory_allocation (with error bit) on memory allocation error. + * F_memory_reallocation (with error bit) on memory reallocation error. + * F_parameter (with error bit) if a parameter is invalid. + * F_buffer_too_large (with error bit) if the new array length is too large. + */ +#ifndef _di_fl_string_lengths_increase_ + extern f_return_status fl_string_lengths_increase(f_string_lengths_t *lengths); +#endif // _di_fl_string_lengths_increase_ /** - * Resize the array of string lengths to a larger size. + * Resize the string lengths array to a larger size. * * This will resize making the string larger based on the given length. * If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size). * If already set to the maximum buffer size, then the resize will fail. * - * @param length - * A positive number greater than 0 representing how much to increase the size by. - * @param strings - * The string array to resize. + * @param amount + * A positive number representing how much to increase the size by. + * @param lengths + * The string lengths array to resize. * * @return * F_none on success. + * F_buffer_too_large on success, but the requested length is too large for the buffer. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. * F_parameter (with error bit) if a parameter is invalid. - * F_string_too_large (with error bit) if the combined string is too large. + * F_buffer_too_large (with error bit) if the new array length is too large. */ -#ifndef _di_fl_string_lengths_size_increase_ - extern f_return_status fl_string_lengths_size_increase(const f_array_length_t length, f_string_lengths_t *lengths); -#endif // _di_fl_string_lengths_size_increase_ +#ifndef _di_fl_string_lengths_increase_by_ + extern f_return_status fl_string_lengths_increase_by(const f_array_length_t amount, f_string_lengths_t *lengths); +#endif // _di_fl_string_lengths_increase_by_ /** * Append the source string onto the destination with the glue in between. diff --git a/level_2/fll_fss/c/fss_basic.c b/level_2/fll_fss/c/fss_basic.c index 4c23006..fb94645 100644 --- a/level_2/fll_fss/c/fss_basic.c +++ b/level_2/fll_fss/c/fss_basic.c @@ -180,7 +180,7 @@ extern "C" { } else { if (destination->used + 1 > destination->size) { - status = fl_string_dynamic_size_increase(f_fss_default_allocation_step, destination); + status = fl_string_dynamic_increase_by(f_fss_default_allocation_step, destination); if (F_status_is_error(status)) return status; } diff --git a/level_2/fll_fss/c/fss_basic.h b/level_2/fll_fss/c/fss_basic.h index 351ddac..72cf40a 100644 --- a/level_2/fll_fss/c/fss_basic.h +++ b/level_2/fll_fss/c/fss_basic.h @@ -97,7 +97,7 @@ extern "C" { * * Errors (with error bit) from: fl_fss_basic_content_write_string(). * Errors (with error bit) from: fl_fss_basic_object_write_string(). - * Errors (with error bit) from: fl_string_dynamic_size_increase(). + * Errors (with error bit) from: fl_string_dynamic_increase_by(). */ #ifndef _di_fll_fss_basic_write_string_ extern f_return_status fll_fss_basic_write_string(const f_string_static_t object, const f_string_static_t content, const f_fss_quote_t quote, f_string_dynamic_t *destination); diff --git a/level_2/fll_fss/c/fss_basic_list.h b/level_2/fll_fss/c/fss_basic_list.h index 4142638..e84a796 100644 --- a/level_2/fll_fss/c/fss_basic_list.h +++ b/level_2/fll_fss/c/fss_basic_list.h @@ -96,7 +96,7 @@ extern "C" { * * Errors (with error bit) from: fl_fss_basic_list_content_write_string(). * Errors (with error bit) from: fl_fss_basic_list_object_write_string(). - * Errors (with error bit) from: fl_string_dynamic_size_increase(). + * Errors (with error bit) from: fl_string_dynamic_increase_by(). */ #ifndef _di_fll_fss_basic_list_write_string_ extern f_return_status fll_fss_basic_list_write_string(const f_string_static_t object, const f_string_static_t content, const f_string_static_t *content_prepend, f_string_dynamic_t *buffer); diff --git a/level_2/fll_fss/c/fss_extended.h b/level_2/fll_fss/c/fss_extended.h index 12ccb4b..ec94c37 100644 --- a/level_2/fll_fss/c/fss_extended.h +++ b/level_2/fll_fss/c/fss_extended.h @@ -98,7 +98,7 @@ extern "C" { * * Errors (with error bit) from: fl_fss_extended_content_write_string(). * Errors (with error bit) from: fl_fss_extended_object_write_string(). - * Errors (with error bit) from: fl_string_dynamic_size_increase(). + * Errors (with error bit) from: fl_string_dynamic_increase_by(). */ #ifndef _di_fll_fss_extended_write_string_ extern f_return_status fll_fss_extended_write_string(const f_string_static_t object, const f_string_statics_t contents, const f_fss_quote_t quote, f_string_dynamic_t *destination); diff --git a/level_2/fll_fss/c/fss_extended_list.h b/level_2/fll_fss/c/fss_extended_list.h index 253e9ec..c7396f3 100644 --- a/level_2/fll_fss/c/fss_extended_list.h +++ b/level_2/fll_fss/c/fss_extended_list.h @@ -105,7 +105,7 @@ extern "C" { * * Errors (with error bit) from: fl_fss_extended_list_content_write_string(). * Errors (with error bit) from: fl_fss_extended_list_object_write_string(). - * Errors (with error bit) from: fl_string_dynamic_size_increase(). + * Errors (with error bit) from: fl_string_dynamic_increase_by(). */ #ifndef _di_fll_fss_extended_list_write_string_ extern f_return_status fll_fss_extended_list_write_string(const f_string_static_t object, const f_string_static_t content, const f_string_static_t *content_prepend, const f_string_ranges_t *ignore, f_string_dynamic_t *destination); diff --git a/level_2/fll_iki/c/iki.h b/level_2/fll_iki/c/iki.h index 897f6ba..c0d3f74 100644 --- a/level_2/fll_iki/c/iki.h +++ b/level_2/fll_iki/c/iki.h @@ -53,7 +53,7 @@ extern "C" { * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_macro_string_dynamic_t_resize(). - * Errors (with error bit) from: fl_string_dynamic_size_increase(). + * Errors (with error bit) from: fl_string_dynamic_increase_by(). */ #ifndef _di_fll_iki_content_escape_ extern f_return_status fll_iki_content_escape(const f_string_static_t content, const uint8_t quote, f_string_dynamic_t *escaped); @@ -80,7 +80,7 @@ extern "C" { * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_macro_string_dynamic_t_resize(). - * Errors (with error bit) from: fl_string_dynamic_size_increase(). + * Errors (with error bit) from: fl_string_dynamic_increase_by(). */ #ifndef _di_fll_iki_content_partial_escape_ extern f_return_status fll_iki_content_partial_escape(const f_string_static_t content, const f_string_range_t range, const uint8_t quote, f_string_dynamic_t *escaped); @@ -106,7 +106,7 @@ extern "C" { * F_syntax (with error bit) if the given string is invalid, such as having an undelimited quote. * * Errors (with error bit) from: f_macro_string_dynamic_t_resize(). - * Errors (with error bit) from: fl_string_dynamic_size_increase(). + * Errors (with error bit) from: fl_string_dynamic_increase_by(). */ #ifndef _di_fll_iki_content_escape_un_ extern f_return_status fll_iki_content_escape_un(const f_string_static_t content, const uint8_t quote, f_string_dynamic_t *unescaped); @@ -134,7 +134,7 @@ extern "C" { * F_syntax (with error bit) if the given string is invalid, such as having an undelimited quote. * * Errors (with error bit) from: f_macro_string_dynamic_t_resize(). - * Errors (with error bit) from: fl_string_dynamic_size_increase(). + * Errors (with error bit) from: fl_string_dynamic_increase_by(). */ #ifndef _di_fll_iki_content_partial_escape_un_ extern f_return_status fll_iki_content_partial_escape_un(const f_string_static_t content, const f_string_range_t range, const uint8_t quote, f_string_dynamic_t *unescaped); diff --git a/level_2/fll_iki/c/private-iki.c b/level_2/fll_iki/c/private-iki.c index 36b4679..b110c7c 100644 --- a/level_2/fll_iki/c/private-iki.c +++ b/level_2/fll_iki/c/private-iki.c @@ -23,7 +23,7 @@ extern "C" { if (content.string[i] == quote) { if (escaped->used + delimits + 2 > escaped->size) { - status = fl_string_dynamic_size_increase(delimits + 2, escaped); + status = fl_string_dynamic_increase_by(delimits + 2, escaped); if (F_status_is_error(status)) return status; } @@ -38,7 +38,7 @@ extern "C" { } else if (content.string[i]) { if (escaped->used + 1 > escaped->size) { - status = fl_string_dynamic_size_increase(f_memory_default_allocation_step, escaped); + status = fl_string_dynamic_increase_by(f_memory_default_allocation_step, escaped); if (F_status_is_error(status)) return status; } @@ -56,7 +56,7 @@ extern "C" { // delimits found at the end must be escaped to prevent escaping the end quote. if (delimits) { if (escaped->used + delimits > escaped->size) { - status = fl_string_dynamic_size_increase(delimits, escaped); + status = fl_string_dynamic_increase_by(delimits, escaped); if (F_status_is_error(status)) return status; } @@ -113,7 +113,7 @@ extern "C" { delimits /= 2; if (unescaped->used + delimits + 1 > unescaped->size) { - status = fl_string_dynamic_size_increase(delimits + 1, unescaped); + status = fl_string_dynamic_increase_by(delimits + 1, unescaped); if (F_status_is_error(status)) return status; } @@ -130,7 +130,7 @@ extern "C" { } else if (content.string[j]) { if (unescaped->used + (j - i) + 1 > unescaped->size) { - status = fl_string_dynamic_size_increase((j - i) + 1, unescaped); + status = fl_string_dynamic_increase_by((j - i) + 1, unescaped); if (F_status_is_error(status)) return status; } @@ -160,7 +160,7 @@ extern "C" { delimits /= 2; if (unescaped->used + delimits > unescaped->size) { - status = fl_string_dynamic_size_increase(delimits, unescaped); + status = fl_string_dynamic_increase_by(delimits, unescaped); if (F_status_is_error(status)) return status; } @@ -173,7 +173,7 @@ extern "C" { } else if (content.string[i]) { if (unescaped->used + 1 > unescaped->size) { - status = fl_string_dynamic_size_increase(f_memory_default_allocation_step, unescaped); + status = fl_string_dynamic_increase_by(f_memory_default_allocation_step, unescaped); if (F_status_is_error(status)) return status; } diff --git a/level_2/fll_iki/c/private-iki.h b/level_2/fll_iki/c/private-iki.h index 84bd7c9..4e6efab 100644 --- a/level_2/fll_iki/c/private-iki.h +++ b/level_2/fll_iki/c/private-iki.h @@ -36,7 +36,7 @@ extern "C" { * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_macro_string_dynamic_t_resize(). - * Errors (with error bit) from: fl_string_dynamic_size_increase(). + * Errors (with error bit) from: fl_string_dynamic_increase_by(). */ #if !defined(_di_fll_iki_content_escape_) || !defined(_di_fll_iki_content_partial_escape_) extern f_return_status private_fll_iki_content_partial_escape(const f_string_static_t content, const f_string_range_t range, const uint8_t quote, f_string_dynamic_t *escaped) f_gcc_attribute_visibility_internal; @@ -64,7 +64,7 @@ extern "C" { * F_syntax (with error bit) if the given string is invalid, such as having an undelimited quote. * * Errors (with error bit) from: f_macro_string_dynamic_t_resize(). - * Errors (with error bit) from: fl_string_dynamic_size_increase(). + * Errors (with error bit) from: fl_string_dynamic_increase_by(). */ #if !defined(_di_fll_iki_content_escape_un_) || !defined(_di_fll_iki_content_partial_escape_un_) extern f_return_status private_fll_iki_content_partial_escape_un(const f_string_static_t content, const f_string_range_t range, const uint8_t quote, f_string_dynamic_t *unescaped) f_gcc_attribute_visibility_internal; diff --git a/level_3/fake/c/private-make.c b/level_3/fake/c/private-make.c index ab46c21..8b69a28 100644 --- a/level_3/fake/c/private-make.c +++ b/level_3/fake/c/private-make.c @@ -446,10 +446,10 @@ extern "C" { if (k == data_make->setting_build.environment.used) { if (data_make->setting_build.environment.used + 1 > data_make->setting_build.environment.size) { - *status = fl_string_dynamics_size_increase(f_memory_default_allocation_step, &data_make->setting_build.environment); + *status = fl_string_dynamics_increase_by(f_memory_default_allocation_step, &data_make->setting_build.environment); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "fl_string_lengths_size_increase", F_true); + fll_error_print(data.error, F_status_set_fine(*status), "fl_string_lengths_increase_by", F_true); break; } } @@ -765,10 +765,10 @@ extern "C" { if (data.context.mode != f_color_mode_none) { if (data_make->parameter.color.used >= data_make->parameter.color.size) { - *status = fl_string_dynamics_size_increase(f_memory_default_allocation_step, &data_make->parameter.color); + *status = fl_string_dynamics_increase_by(f_memory_default_allocation_step, &data_make->parameter.color); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "fl_string_dynamics_size_increase", F_true); + fll_error_print(data.error, F_status_set_fine(*status), "fl_string_dynamics_increase_by", F_true); return; } } @@ -821,10 +821,10 @@ extern "C" { if (data.error.verbosity != f_console_verbosity_normal) { if (data_make->parameter.verbosity.used >= data_make->parameter.verbosity.size) { - *status = fl_string_dynamics_size_increase(f_memory_default_allocation_step, &data_make->parameter.verbosity); + *status = fl_string_dynamics_increase_by(f_memory_default_allocation_step, &data_make->parameter.verbosity); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "fl_string_dynamics_size_increase", F_true); + fll_error_print(data.error, F_status_set_fine(*status), "fl_string_dynamics_increase_by", F_true); return; } } @@ -904,10 +904,10 @@ extern "C" { for (j = 0; j < source[i]->used; j++) { if (destination[i]->used >= destination[i]->size) { - *status = fl_string_dynamics_size_increase(f_memory_default_allocation_step, destination[i]); + *status = fl_string_dynamics_increase_by(f_memory_default_allocation_step, destination[i]); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "fl_string_dynamics_size_increase", F_true); + fll_error_print(data.error, F_status_set_fine(*status), "fl_string_dynamics_increase_by", F_true); return; } } @@ -932,10 +932,10 @@ extern "C" { } if (destination[i]->used >= destination[i]->size) { - *status = fl_string_dynamics_size_increase(f_memory_default_allocation_step, destination[i]); + *status = fl_string_dynamics_increase_by(f_memory_default_allocation_step, destination[i]); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "fl_string_dynamics_size_increase", F_true); + fll_error_print(data.error, F_status_set_fine(*status), "fl_string_dynamics_increase_by", F_true); return; } } @@ -997,10 +997,10 @@ extern "C" { for (uint8_t i = 0; i < 7; i ++) { if (destination[i]->used >= destination[i]->size) { - *status = fl_string_dynamics_size_increase(f_memory_default_allocation_step, destination[i]); + *status = fl_string_dynamics_increase_by(f_memory_default_allocation_step, destination[i]); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "fl_string_dynamics_size_increase", F_true); + fll_error_print(data.error, F_status_set_fine(*status), "fl_string_dynamics_increase_by", F_true); return; } } @@ -1025,10 +1025,10 @@ extern "C" { } if (destination[i]->used >= destination[i]->size) { - *status = fl_string_dynamics_size_increase(f_memory_default_allocation_step, destination[i]); + *status = fl_string_dynamics_increase_by(f_memory_default_allocation_step, destination[i]); if (F_status_is_error(*status)) { - fll_error_print(data.error, F_status_set_fine(*status), "fl_string_dynamics_size_increase", F_true); + fll_error_print(data.error, F_status_set_fine(*status), "fl_string_dynamics_increase_by", F_true); return; } } @@ -1173,10 +1173,10 @@ extern "C" { // pre-allocate the known arguments size. if (arguments->used + content.used > arguments->size) { - *status = fl_string_dynamics_size_increase(content.used, arguments); + *status = fl_string_dynamics_increase_by(content.used, arguments); if (F_status_is_error(*status) || *status == F_string_too_large) { - fll_error_print(data_make->error, F_status_set_fine(*status), "fl_string_dynamics_size_increase", F_true); + fll_error_print(data_make->error, F_status_set_fine(*status), "fl_string_dynamics_increase_by", F_true); return; } } @@ -1267,10 +1267,10 @@ extern "C" { } if (arguments->used >= arguments->size) { - *status = fl_string_dynamics_size_increase(f_memory_default_allocation_step, arguments); + *status = fl_string_dynamics_increase_by(f_memory_default_allocation_step, arguments); if (F_status_is_error(*status)) { - fll_error_print(data_make->error, F_status_set_fine(*status), "fl_string_lengths_size_increase", F_true); + fll_error_print(data_make->error, F_status_set_fine(*status), "fl_string_lengths_increase_by", F_true); return; } } @@ -1353,10 +1353,10 @@ extern "C" { if (fl_string_dynamic_partial_compare_string(reserved_name[k], data_make->buffer, reserved_length[k], iki_content.array[j]) == F_equal_to) { if (arguments->used >= arguments->size) { - *status = fl_string_dynamics_size_increase(f_memory_default_allocation_step, arguments); + *status = fl_string_dynamics_increase_by(f_memory_default_allocation_step, arguments); if (F_status_is_error(*status)) { - fll_error_print(data_make->error, F_status_set_fine(*status), "fl_string_dynamics_size_increase", F_true); + fll_error_print(data_make->error, F_status_set_fine(*status), "fl_string_dynamics_increase_by", F_true); return; } } @@ -1423,10 +1423,10 @@ extern "C" { } else { if (arguments->used >= arguments->size) { - *status = fl_string_dynamics_size_increase(f_memory_default_allocation_step, arguments); + *status = fl_string_dynamics_increase_by(f_memory_default_allocation_step, arguments); if (F_status_is_error(*status)) { - fll_error_print(data_make->error, F_status_set_fine(*status), "fl_string_dynamics_size_increase", F_true); + fll_error_print(data_make->error, F_status_set_fine(*status), "fl_string_dynamics_increase_by", F_true); break; } } @@ -1801,7 +1801,7 @@ extern "C" { status = fl_string_dynamic_append_nulless(value, &arguments->array[arguments->used]); } else { - status = fl_string_dynamics_size_increase(f_memory_default_allocation_step, arguments); + status = fl_string_dynamics_increase_by(f_memory_default_allocation_step, arguments); if (F_status_is_error_not(status)) { status = fl_string_dynamic_append_nulless(value, &arguments->array[arguments->used]); @@ -1857,7 +1857,7 @@ extern "C" { status = fl_string_dynamic_append_nulless(value, &arguments->array[arguments->used]); } else { - status = fl_string_dynamics_size_increase(f_memory_default_allocation_step, arguments); + status = fl_string_dynamics_increase_by(f_memory_default_allocation_step, arguments); if (F_status_is_error_not(status)) { status = fl_string_dynamic_append_nulless(value, &arguments->array[arguments->used]); @@ -1900,10 +1900,10 @@ extern "C" { // add the operation id to the operation stack. if (section_stack->used + 1 > section_stack->size) { - *status = fl_string_lengths_size_increase(f_memory_default_allocation_step, section_stack); + *status = fl_string_lengths_increase_by(f_memory_default_allocation_step, section_stack); if (F_status_is_error(*status)) { - fll_error_print(data_make->error, F_status_set_fine(*status), "fl_string_lengths_size_increase", F_true); + fll_error_print(data_make->error, F_status_set_fine(*status), "fl_string_lengths_increase_by", F_true); return; } } @@ -3632,10 +3632,10 @@ extern "C" { } else { if (data_make->path.stack.used == data_make->path.stack.size) { - *status = fl_string_dynamics_size_increase(f_memory_default_allocation_step, &data_make->path.stack); + *status = fl_string_dynamics_increase_by(f_memory_default_allocation_step, &data_make->path.stack); if (F_status_set_fine(*status) == F_buffer_too_large) { - fake_print_message_section_operation_path_stack_max(data, data_make->error, F_buffer_too_large, "fl_string_lengths_size_increase", "path stack"); + fake_print_message_section_operation_path_stack_max(data, data_make->error, F_buffer_too_large, "fl_string_lengths_increase_by", "path stack"); return; } else if (F_status_is_error(*status)) { diff --git a/level_3/fss_basic_list_write/c/private-fss_basic_list_write.c b/level_3/fss_basic_list_write/c/private-fss_basic_list_write.c index 2f50280..8905c42 100644 --- a/level_3/fss_basic_list_write/c/private-fss_basic_list_write.c +++ b/level_3/fss_basic_list_write/c/private-fss_basic_list_write.c @@ -172,10 +172,10 @@ extern "C" { } if (object.used + block.used > object.size) { - status = fl_string_dynamic_size_increase(block.used, &object); + status = fl_string_dynamic_increase_by(block.used, &object); if (F_status_is_error(status)) { - fll_error_print(data.error, F_status_set_fine(status), "fl_string_dynamic_size_increase", F_true); + fll_error_print(data.error, F_status_set_fine(status), "fl_string_dynamic_increase_by", F_true); break; } } @@ -221,10 +221,10 @@ extern "C" { if (total) { if (content.used + total > content.size) { - status = fl_string_dynamic_size_increase(total, &content); + status = fl_string_dynamic_increase_by(total, &content); if (F_status_is_error(status)) { - fll_error_print(data.error, F_status_set_fine(status), "fl_string_dynamic_size_increase", F_true); + fll_error_print(data.error, F_status_set_fine(status), "fl_string_dynamic_increase_by", F_true); break; } } diff --git a/level_3/fss_basic_write/c/private-fss_basic_write.c b/level_3/fss_basic_write/c/private-fss_basic_write.c index 46b6989..68bcd43 100644 --- a/level_3/fss_basic_write/c/private-fss_basic_write.c +++ b/level_3/fss_basic_write/c/private-fss_basic_write.c @@ -184,10 +184,10 @@ extern "C" { } if (object.used + block.used > object.size) { - status = fl_string_dynamic_size_increase(block.used, &object); + status = fl_string_dynamic_increase_by(block.used, &object); if (F_status_is_error(status)) { - fll_error_print(data.error, F_status_set_fine(status), "fl_string_dynamic_size_increase", F_true); + fll_error_print(data.error, F_status_set_fine(status), "fl_string_dynamic_increase_by", F_true); break; } } @@ -233,10 +233,10 @@ extern "C" { if (total) { if (content.used + total > content.size) { - status = fl_string_dynamic_size_increase(total, &content); + status = fl_string_dynamic_increase_by(total, &content); if (F_status_is_error(status)) { - fll_error_print(data.error, F_status_set_fine(status), "fl_string_dynamic_size_increase", F_true); + fll_error_print(data.error, F_status_set_fine(status), "fl_string_dynamic_increase_by", F_true); break; } } diff --git a/level_3/fss_extended_list_write/c/private-fss_extended_list_write.c b/level_3/fss_extended_list_write/c/private-fss_extended_list_write.c index 5c3cf42..6f3d2b5 100644 --- a/level_3/fss_extended_list_write/c/private-fss_extended_list_write.c +++ b/level_3/fss_extended_list_write/c/private-fss_extended_list_write.c @@ -177,10 +177,10 @@ extern "C" { } if (object.used + block.used > object.size) { - status = fl_string_dynamic_size_increase(block.used, &object); + status = fl_string_dynamic_increase_by(block.used, &object); if (F_status_is_error(status)) { - fll_error_print(data.error, F_status_set_fine(status), "fl_string_dynamic_size_increase", F_true); + fll_error_print(data.error, F_status_set_fine(status), "fl_string_dynamic_increase_by", F_true); break; } } @@ -226,10 +226,10 @@ extern "C" { if (total) { if (content.used + total > content.size) { - status = fl_string_dynamic_size_increase(total, &content); + status = fl_string_dynamic_increase_by(total, &content); if (F_status_is_error(status)) { - fll_error_print(data.error, F_status_set_fine(status), "fl_string_dynamic_size_increase", F_true); + fll_error_print(data.error, F_status_set_fine(status), "fl_string_dynamic_increase_by", F_true); break; } } diff --git a/level_3/fss_extended_write/c/fss_extended_write.c b/level_3/fss_extended_write/c/fss_extended_write.c index 095ad41..c8f65f0 100644 --- a/level_3/fss_extended_write/c/fss_extended_write.c +++ b/level_3/fss_extended_write/c/fss_extended_write.c @@ -426,14 +426,14 @@ extern "C" { else { object.used = 0; - status = fl_string_dynamics_size_increase(data->parameters[fss_extended_write_parameter_content].values.used, &contents); + status = fl_string_dynamics_increase_by(data->parameters[fss_extended_write_parameter_content].values.used, &contents); if (status == F_buffer_too_large) { status = F_status_set_error(status); } if (F_status_is_error(status)) { - fll_error_print(data->error, F_status_set_fine(status), "fl_string_dynamics_size_increase", F_true); + fll_error_print(data->error, F_status_set_fine(status), "fl_string_dynamics_increase_by", F_true); } else { f_array_length_t i = 0; @@ -489,10 +489,10 @@ extern "C" { if (content_current < object_current || content_current > object_next) break; } - status = fl_string_dynamics_size_increase(f_fss_default_allocation_step, &contents); + status = fl_string_dynamics_increase_by(f_fss_default_allocation_step, &contents); if (F_status_is_error(status)) { - fll_error_print(data->error, F_status_set_fine(status), "fl_string_dynamics_size_increase", F_true); + fll_error_print(data->error, F_status_set_fine(status), "fl_string_dynamics_increase_by", F_true); break; } diff --git a/level_3/fss_extended_write/c/private-fss_extended_write.c b/level_3/fss_extended_write/c/private-fss_extended_write.c index 7e8dc4d..dd7f0bd 100644 --- a/level_3/fss_extended_write/c/private-fss_extended_write.c +++ b/level_3/fss_extended_write/c/private-fss_extended_write.c @@ -196,10 +196,10 @@ extern "C" { } if (object.used + block.used > object.size) { - status = fl_string_dynamic_size_increase(block.used, &object); + status = fl_string_dynamic_increase_by(block.used, &object); if (F_status_is_error(status)) { - fll_error_print(data.error, F_status_set_fine(status), "fl_string_dynamic_size_increase", F_true); + fll_error_print(data.error, F_status_set_fine(status), "fl_string_dynamic_increase_by", F_true); break; } } @@ -237,10 +237,10 @@ extern "C" { if (state == 0x2) { if (contents.used + 1 > contents.size) { - status = fl_string_dynamics_size_increase(f_fss_default_allocation_step, &contents); + status = fl_string_dynamics_increase_by(f_fss_default_allocation_step, &contents); if (F_status_is_error(status)) { - fll_error_print(data.error, F_status_set_fine(status), "fl_string_dynamics_size_increase", F_true); + fll_error_print(data.error, F_status_set_fine(status), "fl_string_dynamics_increase_by", F_true); break; } } @@ -262,10 +262,10 @@ extern "C" { if (block.string[range.start] == fss_extended_write_pipe_content_start) { if (contents.used + 1 > contents.size) { - status = fl_string_dynamics_size_increase(f_fss_default_allocation_step, &contents); + status = fl_string_dynamics_increase_by(f_fss_default_allocation_step, &contents); if (F_status_is_error(status)) { - fll_error_print(data.error, F_status_set_fine(status), "fl_string_dynamics_size_increase", F_true); + fll_error_print(data.error, F_status_set_fine(status), "fl_string_dynamics_increase_by", F_true); break; } } @@ -293,10 +293,10 @@ extern "C" { } if (contents.array[contents.used - 1].used + 1 > contents.array[contents.used - 1].size) { - status = fl_string_dynamic_size_increase(f_fss_default_allocation_step, &contents.array[contents.used - 1]); + status = fl_string_dynamic_increase_by(f_fss_default_allocation_step, &contents.array[contents.used - 1]); if (F_status_is_error(status)) { - fll_error_print(data.error, F_status_set_fine(status), "fl_string_dynamic_size_increase", F_true); + fll_error_print(data.error, F_status_set_fine(status), "fl_string_dynamic_increase_by", F_true); break; } }