From 2cdb03d14d5e21fd5c87f6c8de6d5c6a9d7e53f0 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Sun, 16 Jan 2022 16:52:25 -0600 Subject: [PATCH] Cleanup: Add additional initializer for f_string_static_t to allow initializing all parts. Another acceptable practice is to set the used to some value greater than zero and size to zero to better designate that this is a static string and is not dynamically allocated. --- level_0/f_string/c/string_dynamic.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/level_0/f_string/c/string_dynamic.h b/level_0/f_string/c/string_dynamic.h index 78c95a1..15830c3 100644 --- a/level_0/f_string/c/string_dynamic.h +++ b/level_0/f_string/c/string_dynamic.h @@ -24,7 +24,8 @@ extern "C" { * * The f_string_static_t type should never be directly allocated or deallocated. * - * A special macro_f_string_static_t_initialize() is provided for the special purpose of easily initialize a static string. + * A special macro_f_string_static_t_initialize() is provided for the special purpose of easily initialize a static string with an identical used and size. + * A special macro_f_string_static_t_initialize2() is provided for the special purpose of easily initialize a static string. * * string: The string. * size: Total amount of space available. @@ -46,6 +47,7 @@ extern "C" { string_static.used = 0; #define macro_f_string_static_t_initialize(string, length) { string, length, length } + #define macro_f_string_static_t_initialize2(string, size, used) { string, size, used } #endif // _di_f_string_static_t_ /** -- 1.8.3.1