From: Kevin Day Date: Mon, 23 May 2022 01:51:29 +0000 (-0500) Subject: Cleanup: Use macro_f_string_static_t_initialize2() with macro_f_string_static_t_initi... X-Git-Tag: 0.5.10~106 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=c641c063beb30d04513776cf069300f5900cfc15;p=fll Cleanup: Use macro_f_string_static_t_initialize2() with macro_f_string_static_t_initialize(). Using macro_f_string_static_t_initialize2() was the old way and is now deemed incorrect. The macro_f_string_static_t_initialize2() applies the length parameter to both the used and size. For static strings the size is always 0 because nothing is dynamically allocated. Therefore, using macro_f_string_static_t_initialize2() for static string initialization is incorrect. --- diff --git a/level_1/fl_directory/c/directory.c b/level_1/fl_directory/c/directory.c index 2176292..f1646a2 100644 --- a/level_1/fl_directory/c/directory.c +++ b/level_1/fl_directory/c/directory.c @@ -145,8 +145,8 @@ extern "C" { if (F_status_is_error(status)) return status; if (status == F_false) return F_status_set_error(F_directory_not); - f_string_static_t static_source = macro_f_string_static_t_initialize2(source.string, source.used); - f_string_static_t static_destination = macro_f_string_static_t_initialize2(destination.string, destination.used); + f_string_static_t static_source = macro_f_string_static_t_initialize(source.string, 0, source.used); + f_string_static_t static_destination = macro_f_string_static_t_initialize(destination.string, 0, destination.used); // Do not allow null termination or trailing path separators in the string's length calculation. { @@ -213,8 +213,8 @@ extern "C" { if (F_status_is_error(status)) return status; } - f_string_static_t static_source = macro_f_string_static_t_initialize2(source.string, source.used); - f_string_static_t static_destination = macro_f_string_static_t_initialize2(destination.string, destination.used); + f_string_static_t static_source = macro_f_string_static_t_initialize(source.string, 0, source.used); + f_string_static_t static_destination = macro_f_string_static_t_initialize(destination.string, 0, destination.used); // Do not allow null termination or trailing path separators in the string's length calculation. { @@ -267,8 +267,8 @@ extern "C" { if (F_status_is_error(status)) return status; if (status == F_false) return F_status_set_error(F_directory_not); - f_string_static_t static_source = macro_f_string_static_t_initialize2(source.string, source.used); - f_string_static_t static_destination = macro_f_string_static_t_initialize2(destination.string, destination.used); + f_string_static_t static_source = macro_f_string_static_t_initialize(source.string, 0, source.used); + f_string_static_t static_destination = macro_f_string_static_t_initialize(destination.string, 0, destination.used); // Do not allow null termination or trailing path separators in the string's length calculation. { diff --git a/level_3/controller/c/entry/private-entry.c b/level_3/controller/c/entry/private-entry.c index a196043..a50fc05 100644 --- a/level_3/controller/c/entry/private-entry.c +++ b/level_3/controller/c/entry/private-entry.c @@ -1119,7 +1119,7 @@ extern "C" { const f_array_length_t id_rule_length = entry_action->parameters.array[0].used + entry_action->parameters.array[1].used + 1; f_char_t id_rule_name[id_rule_length + 1]; - const f_string_static_t alias_rule = macro_f_string_static_t_initialize2(id_rule_name, id_rule_length); + const f_string_static_t alias_rule = macro_f_string_static_t_initialize(id_rule_name, 0, id_rule_length); memcpy(id_rule_name, entry_action->parameters.array[0].string, sizeof(f_char_t) * entry_action->parameters.array[0].used); memcpy(id_rule_name + entry_action->parameters.array[0].used + 1, entry_action->parameters.array[1].string, sizeof(f_char_t) * entry_action->parameters.array[1].used); diff --git a/level_3/fake/c/private-make-operate.c b/level_3/fake/c/private-make-operate.c index cd76300..674f72d 100644 --- a/level_3/fake/c/private-make-operate.c +++ b/level_3/fake/c/private-make-operate.c @@ -161,9 +161,9 @@ extern "C" { return; } - const f_string_static_t vocabulary_context = macro_f_string_static_t_initialize2(F_iki_vocabulary_0002_context_s, F_iki_vocabulary_0002_context_s_length); - const f_string_static_t vocabulary_define = macro_f_string_static_t_initialize2(F_iki_vocabulary_0002_define_s, F_iki_vocabulary_0002_define_s_length); - const f_string_static_t vocabulary_parameter = macro_f_string_static_t_initialize2(F_iki_vocabulary_0002_parameter_s, F_iki_vocabulary_0002_parameter_s_length); + const f_string_static_t vocabulary_context = macro_f_string_static_t_initialize(F_iki_vocabulary_0002_context_s, 0, F_iki_vocabulary_0002_context_s_length); + const f_string_static_t vocabulary_define = macro_f_string_static_t_initialize(F_iki_vocabulary_0002_define_s, 0, F_iki_vocabulary_0002_define_s_length); + const f_string_static_t vocabulary_parameter = macro_f_string_static_t_initialize(F_iki_vocabulary_0002_parameter_s, 0, F_iki_vocabulary_0002_parameter_s_length); f_iki_data_t iki_data = f_iki_data_t_initialize;