From 11ac81ccd7fd85fc54c8d6115d705a00a9c266c5 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Fri, 18 Feb 2022 20:10:16 -0600 Subject: [PATCH] Security: Invalid reads, always add NULL for compatibility. After switching from f_string_t to f_string_static_t, the NULL terminated string problem has become apparent. If at any point in time these strings are passed to a standard function that expects NULL terminated strings, then an invalid read (or write) can occur. Manually appending a NULL termination every time its needed has made the code messier than I would like. This commit changes the behavior to instead always append a NULL termination after the string.used when appending strings. I accept the additional resource cost of 1-byte per string to guarantee this. This should make the program more easily more secure by catering to the NULL terminated string code out there. This project still doesn't need the or care about NULL termination for most (but not all) of its functions. --- level_0/f_string/c/private-string.c | 34 ++--- level_1/fl_environment/c/environment.c | 23 +-- level_1/fl_environment/c/environment.h | 5 +- level_2/fll_execute/c/execute.c | 8 - level_2/fll_execute/c/execute.h | 12 -- level_2/fll_execute/c/private-execute.c | 9 -- level_2/fll_execute/c/private-execute.h | 4 - level_2/fll_fss/c/fss.c | 3 - level_2/fll_path/c/path.c | 3 - level_2/fll_path/c/path.h | 2 - level_3/control/c/private-control.c | 15 -- level_3/control/c/private-control.h | 2 - level_3/controller/c/common/private-common.c | 3 + level_3/controller/c/common/private-common.h | 9 ++ level_3/controller/c/controller.c | 31 ---- .../controller/c/controller/private-controller.c | 23 +-- .../controller/c/controller/private-controller.h | 8 - level_3/controller/c/entry/private-entry.c | 32 ---- level_3/controller/c/entry/private-entry.h | 4 - level_3/controller/c/entry/private-entry_print.c | 4 +- level_3/controller/c/process/private-process.c | 12 +- level_3/controller/c/process/private-process.h | 2 - level_3/controller/c/rule/private-rule.c | 165 +-------------------- level_3/controller/c/rule/private-rule.h | 5 - level_3/fake/c/private-build-library.c | 8 - level_3/fake/c/private-build-load.c | 31 ---- level_3/fake/c/private-build-load.h | 2 - level_3/fake/c/private-build-objects.c | 8 - level_3/fake/c/private-build.c | 83 ++--------- level_3/fake/c/private-fake-path_generate.c | 55 ------- level_3/fake/c/private-fake.c | 16 -- level_3/fake/c/private-make-load_fakefile.c | 42 ------ level_3/fake/c/private-make-load_fakefile.h | 6 - level_3/fake/c/private-make-operate.c | 36 +---- level_3/fake/c/private-make-operate.h | 2 - level_3/fake/c/private-make-operate_process.c | 8 - level_3/fake/c/private-make-operate_process.h | 2 - level_3/fake/c/private-make-operate_process_type.c | 8 - level_3/fake/c/private-make-operate_process_type.h | 2 - level_3/firewall/c/firewall.c | 4 - level_3/firewall/c/private-firewall.c | 61 +------- 41 files changed, 63 insertions(+), 729 deletions(-) diff --git a/level_0/f_string/c/private-string.c b/level_0/f_string/c/private-string.c index 7e8291f..50e08a8 100644 --- a/level_0/f_string/c/private-string.c +++ b/level_0/f_string/c/private-string.c @@ -8,13 +8,14 @@ extern "C" { #if !defined(_di_f_string_append_) || !defined(_di_f_string_append_assure_) || !defined(_di_f_string_dynamic_append_) || !defined(_di_f_string_dynamic_append_assure_) || !defined(_di_f_string_dynamic_mash_) || !defined(f_string_dynamic_partial_append) || !defined(_di_f_string_dynamic_partial_append_assure_) || !defined(_di_f_string_dynamic_partial_mash_) || !defined(_di_f_string_dynamics_append_) || !defined(_di_f_string_map_multis_append_) || !defined(_di_f_string_mash_) || !defined(_di_f_string_maps_append_) || !defined(_di_f_string_triples_append_) f_status_t private_f_string_append(const f_string_t source, const f_array_length_t length, f_string_dynamic_t * const destination) { - if (destination->used + length > destination->size) { - const f_status_t status = private_f_string_dynamic_increase_by(length, destination); + if (destination->used + length + 1 > destination->size) { + const f_status_t status = private_f_string_dynamic_increase_by(length + 1, destination); if (F_status_is_error(status)) return status; } memcpy(destination->string + destination->used, source, length); destination->used += length; + destination->string[destination->used] = 0; return F_none; } @@ -23,28 +24,30 @@ extern "C" { #if !defined(_di_f_string_append_assure_nulless_) || !defined(_di_f_string_append_nulless_) || !defined(_di_f_string_dynamic_append_assure_nulless_) || !defined(_di_f_string_dynamic_append_nulless_) || !defined(_di_f_string_dynamic_mash_nulless_) || !defined(_di_f_string_dynamic_partial_append_assure_nulless_) || !defined(_di_f_string_dynamic_partial_append_nulless_) || !defined(_di_f_string_dynamic_partial_mash_nulless_) || !defined(_di_f_string_mash_nulless_) f_status_t private_f_string_append_nulless(const f_string_t source, const f_array_length_t length, f_string_dynamic_t * const destination) { - if (destination->used + length > F_string_t_size_d) { - return F_status_set_error(F_string_too_large); - } - f_status_t status = F_none; f_array_length_t i = 0; - f_array_length_t first = 0; f_array_length_t size = 0; + // Count all of the NULLs and subtract them from the total size. for (; i < length; ++i) { + if (source[i]) ++size; + } // for + + if (destination->used + size + 1 > destination->size) { + status = private_f_string_dynamic_increase_by(size + 1, destination); + if (F_status_is_error(status)) return status; + } + + f_array_length_t first = 0; + + for (i = 0, size = 0; i < length; ++i) { if (source[i]) continue; if (i && i > first) { size = i - first; - if (destination->used + size > destination->size) { - status = private_f_string_dynamic_increase_by(size, destination); - if (F_status_is_error(status)) return status; - } - memcpy(destination->string + destination->used, source + first, size); destination->used += size; } @@ -59,15 +62,12 @@ extern "C" { if (i > first) { size = i - first; - if (destination->used + size > destination->size) { - status = private_f_string_dynamic_increase_by(size, destination); - if (F_status_is_error(status)) return status; - } - memcpy(destination->string + destination->used, source + first, size); destination->used += size; } + destination->string[destination->used] = 0; + return F_none; } #endif // !defined(_di_f_string_append_assure_nulless_) || !defined(_di_f_string_append_nulless_) || !defined(_di_f_string_dynamic_append_assure_nulless_) || !defined(_di_f_string_dynamic_append_nulless_) || !defined(_di_f_string_dynamic_mash_nulless_) || !defined(_di_f_string_dynamic_partial_append_assure_nulless_) || !defined(_di_f_string_dynamic_partial_append_nulless_) || !defined(_di_f_string_dynamic_partial_mash_nulless_) || !defined(_di_f_string_mash_nulless_) diff --git a/level_1/fl_environment/c/environment.c b/level_1/fl_environment/c/environment.c index 75bb2f3..b4ec370 100644 --- a/level_1/fl_environment/c/environment.c +++ b/level_1/fl_environment/c/environment.c @@ -20,15 +20,7 @@ extern "C" { environment->array[environment->used].name.used = 0; environment->array[environment->used].value.used = 0; - status = f_string_dynamic_increase_by(name.used + 1, &environment->array[environment->used].name); - - if (F_status_is_error_not(status)) { - status = f_string_dynamic_append_nulless(name, &environment->array[environment->used].name); - } - - if (F_status_is_error_not(status)) { - status = f_string_dynamic_terminate_after(&environment->array[environment->used].name); - } + status = f_string_dynamic_append_nulless(name, &environment->array[environment->used].name); if (F_status_is_error_not(status)) { status = f_environment_get(name, &environment->array[environment->used].value); @@ -65,21 +57,12 @@ extern "C" { environment->array[environment->used].name.used = 0; environment->array[environment->used].value.used = 0; - status = f_string_dynamic_increase_by(names.array[i].used + 1, &environment->array[environment->used].name); - - if (F_status_is_error_not(status)) { - status = f_string_dynamic_append_nulless(names.array[i], &environment->array[environment->used].name); - } - - if (F_status_is_error_not(status)) { - status = f_string_dynamic_terminate_after(&environment->array[environment->used].name); - } + status = f_string_dynamic_append_nulless(names.array[i], &environment->array[environment->used].name); if (F_status_is_error_not(status)) { status = f_environment_get(names.array[i], &environment->array[environment->used].value); } - - if (F_status_is_error(status)) { + else { environment->array[environment->used].name.used = 0; environment->array[environment->used].value.used = 0; diff --git a/level_1/fl_environment/c/environment.h b/level_1/fl_environment/c/environment.h index 944bc39..dc5ae42 100644 --- a/level_1/fl_environment/c/environment.h +++ b/level_1/fl_environment/c/environment.h @@ -47,14 +47,10 @@ extern "C" { * * Errors (with error bit) from: f_environment_get(). * Errors (with error bit) from: f_string_dynamic_append_nulless(). - * Errors (with error bit) from: f_string_dynamic_increase_by(). - * Errors (with error bit) from: f_string_dynamic_terminate_after(). * Errors (with error bit) from: f_string_maps_increase_by(). * * @see f_environment_get() * @see f_string_dynamic_append_nulless() - * @see f_string_dynamic_increase_by() - * @see f_string_dynamic_terminate_after() * @see f_string_maps_increase_by() */ #ifndef _di_fl_environment_load_name_ @@ -73,6 +69,7 @@ extern "C" { * * @param names * An array of valid environment variable names. + * The strings in the array must be NULL terminated. * @param environment * An array of maps generated from the loaded environment variable names. * All environment names loaded are appended to this. diff --git a/level_2/fll_execute/c/execute.c b/level_2/fll_execute/c/execute.c index 71cb58a..ec7a616 100644 --- a/level_2/fll_execute/c/execute.c +++ b/level_2/fll_execute/c/execute.c @@ -149,10 +149,6 @@ extern "C" { status = f_string_dynamic_append(program_name, &paths.array[i]); if (F_status_is_error_not(status)) { - status = f_string_dynamic_terminate_after(&paths.array[i]); - } - - if (F_status_is_error_not(status)) { status = f_file_exists(paths.array[i]); if (status == F_true) { @@ -345,10 +341,6 @@ extern "C" { status = f_string_dynamic_append(program_name, &paths.array[i]); if (F_status_is_error_not(status)) { - status = f_string_dynamic_terminate_after(&paths.array[i]); - } - - if (F_status_is_error_not(status)) { status = f_file_exists(paths.array[i]); if (status == F_true) { diff --git a/level_2/fll_execute/c/execute.h b/level_2/fll_execute/c/execute.h index fa0f1bd..918ea45 100644 --- a/level_2/fll_execute/c/execute.h +++ b/level_2/fll_execute/c/execute.h @@ -71,12 +71,10 @@ extern "C" { * * Errors (with error bit) from: f_string_dynamic_append(). * Errors (with error bit) from: f_string_dynamic_resize(). - * Errors (with error bit) from: f_string_dynamic_terminate_after(). * Errors (with error bit) from: f_string_dynamics_increase(). * * @see f_string_dynamic_append() * @see f_string_dynamic_resize() - * @see f_string_dynamic_terminate_after() * @see f_string_dynamics_increase() */ #ifndef _di_fll_execute_arguments_add_ @@ -109,12 +107,10 @@ extern "C" { * * Errors (with error bit) from: f_string_append(). * Errors (with error bit) from: f_string_dynamic_resize(). - * Errors (with error bit) from: f_string_dynamic_terminate_after(). * Errors (with error bit) from: f_string_dynamics_increase(). * * @see f_string_append() * @see f_string_dynamic_resize() - * @see f_string_dynamic_terminate_after() * @see f_string_dynamics_increase() */ #ifndef _di_fll_execute_arguments_add_parameter_ @@ -149,12 +145,10 @@ extern "C" { * * Errors (with error bit) from: f_string_append(). * Errors (with error bit) from: f_string_dynamic_resize(). - * Errors (with error bit) from: f_string_dynamic_terminate_after(). * Errors (with error bit) from: f_string_dynamics_increase(). * * @see f_string_append() * @see f_string_dynamic_resize() - * @see f_string_dynamic_terminate_after() * @see f_string_dynamics_increase() */ #ifndef _di_fll_execute_arguments_add_parameter_set_ @@ -179,12 +173,10 @@ extern "C" { * * Errors (with error bit) from: f_string_append(). * Errors (with error bit) from: f_string_dynamic_resize(). - * Errors (with error bit) from: f_string_dynamic_terminate_after(). * Errors (with error bit) from: f_string_dynamics_increase(). * * @see f_string_append() * @see f_string_dynamic_resize() - * @see f_string_dynamic_terminate_after() * @see f_string_dynamics_increase() */ #ifndef _di_fll_execute_arguments_add_set_ @@ -228,7 +220,6 @@ extern "C" { * * Errors (with error bit) from: f_environment_get(). * Errors (with error bit) from: f_string_dynamic_append(). - * Errors (with error bit) from: f_string_dynamic_terminate_after(). * Errors (with error bit) from: fl_environment_path_explode(). * * @see execv() @@ -239,7 +230,6 @@ extern "C" { * * @see f_environment_get() * @see f_string_dynamic_append() - * @see f_string_dynamic_terminate_after() * @see fl_environment_path_explode() */ #ifndef _di_fll_execute_into_ @@ -320,7 +310,6 @@ extern "C" { * Errors (with error bit) from: f_signal_mask(). * Errors (with error bit) from: f_string_append(). * Errors (with error bit) from: f_string_dynamic_resize(). - * Errors (with error bit) from: f_string_dynamic_terminate_after(). * Errors (with error bit) from: f_string_dynamics_resize(). * Errors (with error bit) from: f_thread_signal_mask(). * Errors (with error bit) from: fl_environment_path_explode(). @@ -351,7 +340,6 @@ extern "C" { * @see f_limit_process() * @see f_signal_mask() * @see f_string_dynamic_append() - * @see f_string_dynamic_terminate_after() * @see f_string_dynamics_resize() * @see f_thread_signal_mask() * @see fl_control_group_apply() diff --git a/level_2/fll_execute/c/private-execute.c b/level_2/fll_execute/c/private-execute.c index 16b8bc9..8c6188a 100644 --- a/level_2/fll_execute/c/private-execute.c +++ b/level_2/fll_execute/c/private-execute.c @@ -16,9 +16,6 @@ extern "C" { status = f_string_dynamic_append(source, &arguments->array[arguments->used]); if (F_status_is_error(status)) return status; - status = f_string_dynamic_terminate_after(&arguments->array[arguments->used]); - if (F_status_is_error(status)) return status; - ++arguments->used; return F_none; @@ -36,9 +33,6 @@ extern "C" { status = f_string_dynamic_append(prefix, &arguments->array[arguments->used]); if (F_status_is_error(status)) return status; - status = f_string_dynamic_terminate_after(&arguments->array[arguments->used]); - if (F_status_is_error(status)) return status; - ++arguments->used; status = f_string_dynamics_increase(F_memory_default_allocation_small_d, arguments); @@ -52,9 +46,6 @@ extern "C" { status = f_string_dynamic_append(value, &arguments->array[arguments->used]); if (F_status_is_error(status)) return status; - status = f_string_dynamic_terminate_after(&arguments->array[arguments->used]); - if (F_status_is_error(status)) return status; - ++arguments->used; return F_none; diff --git a/level_2/fll_execute/c/private-execute.h b/level_2/fll_execute/c/private-execute.h index 2e25848..8bde5c3 100644 --- a/level_2/fll_execute/c/private-execute.h +++ b/level_2/fll_execute/c/private-execute.h @@ -30,12 +30,10 @@ extern "C" { * * Errors (with error bit) from: f_string_dynamic_increase_by(). * Errors (with error bit) from: f_string_dynamic_resize(). - * Errors (with error bit) from: f_string_dynamic_terminate_after(). * Errors (with error bit) from: f_string_dynamics_increase(). * * @see f_string_dynamic_increase_by() * @see f_string_dynamic_resize() - * @see f_string_dynamic_terminate_after() * @see f_string_dynamics_increase() */ #if !defined(_di_fll_execute_arguments_add_) || !defined(_di_fll_execute_arguments_add_set_) @@ -61,12 +59,10 @@ extern "C" { * * Errors (with error bit) from: f_string_append(). * Errors (with error bit) from: f_string_dynamic_resize(). - * Errors (with error bit) from: f_string_dynamic_terminate_after(). * Errors (with error bit) from: f_string_dynamics_increase(). * * @see f_string_append() * @see f_string_dynamic_resize() - * @see f_string_dynamic_terminate_after() * @see f_string_dynamics_increase() * @see fll_execute_arguments_add_parameter() * @see fll_execute_arguments_add_parameter_set() diff --git a/level_2/fll_fss/c/fss.c b/level_2/fll_fss/c/fss.c index 4e8d786..8226bd9 100644 --- a/level_2/fll_fss/c/fss.c +++ b/level_2/fll_fss/c/fss.c @@ -290,9 +290,6 @@ extern "C" { status = f_string_dynamic_partial_append_nulless(buffer, contents.array[i].array[k], &values[j]->array[values[j]->used]); if (F_status_is_error(status)) return status; - status = f_string_dynamic_terminate_after(&values[j]->array[values[j]->used]); - if (F_status_is_error(status)) return status; - ++values[j]->used; if (indexs) { diff --git a/level_2/fll_path/c/path.c b/level_2/fll_path/c/path.c index 636d029..42232c8 100644 --- a/level_2/fll_path/c/path.c +++ b/level_2/fll_path/c/path.c @@ -139,9 +139,6 @@ extern "C" { --canonical->used; } - status = f_string_dynamic_terminate_after(canonical); - if (F_status_is_error(status)) return status; - return F_none; } #endif // _di_fll_path_canonical_ diff --git a/level_2/fll_path/c/path.h b/level_2/fll_path/c/path.h index e3ca84f..2bed3ea 100644 --- a/level_2/fll_path/c/path.h +++ b/level_2/fll_path/c/path.h @@ -49,13 +49,11 @@ extern "C" { * Errors (with error bit) from: f_string_append(). * Errors (with error bit) from: f_string_append_assure(). * Errors (with error bit) from: f_string_dynamic_append_assure(). - * Errors (with error bit) from: f_string_dynamic_terminate_after(). * * @see f_path_current() * @see f_string_append() * @see f_string_append_assure() * @see f_string_dynamic_append_assure() - * @see f_string_dynamic_terminate_after() */ #ifndef _di_fll_path_canonical_ extern f_status_t fll_path_canonical(const f_string_static_t path, f_string_dynamic_t *canonical); diff --git a/level_3/control/c/private-control.c b/level_3/control/c/private-control.c index 78024ed..ec9076c 100644 --- a/level_3/control/c/private-control.c +++ b/level_3/control/c/private-control.c @@ -263,13 +263,6 @@ extern "C" { fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true); } } - else { - status = f_string_dynamic_terminate_after(&data->cache.buffer_small); - - if (F_status_is_error(status)) { - fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true); - } - } status = f_file_exists(data->cache.buffer_small); @@ -340,14 +333,6 @@ extern "C" { } // for if (F_status_is_error_not(status)) { - status = f_string_dynamic_terminate_after(&data->cache.buffer_small); - - if (F_status_is_error(status)) { - fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true); - } - } - - if (F_status_is_error_not(status)) { status = f_file_exists(data->cache.buffer_small); if (F_status_is_error(status) || status == F_false) { diff --git a/level_3/control/c/private-control.h b/level_3/control/c/private-control.h index ef1cc97..cbcb94e 100644 --- a/level_3/control/c/private-control.h +++ b/level_3/control/c/private-control.h @@ -67,7 +67,6 @@ extern "C" { * Errors (with error bit) from: f_string_append_assure(). * Errors (with error bit) from: f_string_dynamic_append_nulless(). * Errors (with error bit) from: f_string_dynamic_partial_append_nulless(). - * Errors (with error bit) from: f_string_dynamic_terminate_after(). * Errors (with error bit) from: f_string_dynamics_resize(). * Errors (with error bit) from: fl_fss_apply_delimit(). * Errors (with error bit) from: fll_fss_extended_read(). @@ -81,7 +80,6 @@ extern "C" { * @see f_string_append_assure() * @see f_string_dynamic_append_nulless() * @see f_string_dynamic_partial_append_nulless() - * @see f_string_dynamic_terminate_after() * @see f_string_dynamics_resize() * @see fl_fss_apply_delimit() * @see fll_fss_extended_read() diff --git a/level_3/controller/c/common/private-common.c b/level_3/controller/c/common/private-common.c index 2ddfcd0..4c2cb8a 100644 --- a/level_3/controller/c/common/private-common.c +++ b/level_3/controller/c/common/private-common.c @@ -124,6 +124,9 @@ extern "C" { const f_string_static_t controller_wish_s = macro_f_string_static_t_initialize(CONTROLLER_wish_s, 0, CONTROLLER_wish_s_length); const f_string_static_t controller_with_s = macro_f_string_static_t_initialize(CONTROLLER_with_s, 0, CONTROLLER_with_s_length); const f_string_static_t controller_yes_s = macro_f_string_static_t_initialize(CONTROLLER_yes_s, 0, CONTROLLER_yes_s_length); + + const f_string_static_t controller_Entry_s = macro_f_string_static_t_initialize(CONTROLLER_Entry_s, 0, CONTROLLER_Entry_s_length); + const f_string_static_t controller_Exit_s = macro_f_string_static_t_initialize(CONTROLLER_Exit_s, 0, CONTROLLER_Exit_s_length); #endif // _di_controller_string_s_ #ifdef __cplusplus diff --git a/level_3/controller/c/common/private-common.h b/level_3/controller/c/common/private-common.h index cd5a676..bc0ec82 100644 --- a/level_3/controller/c/common/private-common.h +++ b/level_3/controller/c/common/private-common.h @@ -150,6 +150,9 @@ extern "C" { #define CONTROLLER_with_s "with" #define CONTROLLER_yes_s "yes" + #define CONTROLLER_Entry_s "Entry" + #define CONTROLLER_Exit_s "Exit" + #define CONTROLLER_action_s_length 6 #define CONTROLLER_actions_s_length 7 #define CONTROLLER_affinity_s_length 8 @@ -269,6 +272,9 @@ extern "C" { #define CONTROLLER_with_s_length 4 #define CONTROLLER_yes_s_length 3 + #define CONTROLLER_Entry_s_length 5 + #define CONTROLLER_Exit_s_length 4 + extern const f_string_static_t controller_action_s; extern const f_string_static_t controller_actions_s; extern const f_string_static_t controller_affinity_s; @@ -387,6 +393,9 @@ extern "C" { extern const f_string_static_t controller_wish_s; extern const f_string_static_t controller_with_s; extern const f_string_static_t controller_yes_s; + + extern const f_string_static_t controller_Entry_s; + extern const f_string_static_t controller_Exit_s; #endif // _di_controller_string_s_ /** diff --git a/level_3/controller/c/controller.c b/level_3/controller/c/controller.c index 410d307..d69bd65 100644 --- a/level_3/controller/c/controller.c +++ b/level_3/controller/c/controller.c @@ -195,16 +195,6 @@ extern "C" { return status; } - status = f_string_dynamic_terminate_after(&setting.name_entry); - - if (F_status_is_error(status)) { - fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true); - - controller_main_delete(main); - - return status; - } - if (main->parameters.array[controller_parameter_init_e].result == f_console_result_found_e) { main->as_init = F_true; } @@ -308,13 +298,6 @@ extern "C" { if (F_status_is_error(status)) { fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_append", F_true); } - else { - status = f_string_dynamic_terminate_after(&setting.path_pid); - - if (F_status_is_error(status)) { - fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true); - } - } } if (F_status_is_error_not(status)) { @@ -346,13 +329,6 @@ extern "C" { if (F_status_is_error(status)) { fll_error_print(main->error, F_status_set_fine(status), "f_string_append_assure", F_true); } - else { - status = f_string_dynamic_terminate_after(&setting.path_cgroup); - - if (F_status_is_error(status)) { - fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true); - } - } } } else { @@ -439,13 +415,6 @@ extern "C" { if (F_status_is_error(status)) { fll_error_print(main->error, F_status_set_fine(status), "f_string_append_assure", F_true); } - else { - status = f_string_dynamic_terminate_after(&setting.path_cgroup); - - if (F_status_is_error(status)) { - fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true); - } - } } } } diff --git a/level_3/controller/c/controller/private-controller.c b/level_3/controller/c/controller/private-controller.c index 68917dd..2677062 100644 --- a/level_3/controller/c/controller/private-controller.c +++ b/level_3/controller/c/controller/private-controller.c @@ -33,30 +33,21 @@ extern "C" { #ifndef _di_controller_string_dynamic_rip_nulless_terminated_ f_status_t controller_dynamic_rip_nulless_terminated(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination) { - f_status_t status = fl_string_dynamic_rip_nulless(source, range, destination); - if (F_status_is_error(status)) return status; - - return f_string_dynamic_terminate_after(destination); + return fl_string_dynamic_rip_nulless(source, range, destination); } #endif // _di_controller_string_dynamic_rip_nulless_terminated_ #ifndef _di_controller_string_dynamic_append_terminated_ f_status_t controller_dynamic_append_terminated(const f_string_static_t source, f_string_dynamic_t *destination) { - f_status_t status = f_string_dynamic_append_nulless(source, destination); - if (F_status_is_error(status)) return status; - - return f_string_dynamic_terminate_after(destination); + return f_string_dynamic_append_nulless(source, destination); } #endif // _di_controller_string_dynamic_append_terminated_ #ifndef _di_controller_string_dynamic_partial_append_terminated_ f_status_t controller_dynamic_partial_append_terminated(const f_string_static_t source, const f_string_range_t range, f_string_dynamic_t *destination) { - f_status_t status = f_string_dynamic_partial_append(source, range, destination); - if (F_status_is_error(status)) return status; - - return f_string_dynamic_terminate_after(destination); + return f_string_dynamic_partial_append(source, range, destination); } #endif // _di_controller_string_dynamic_partial_append_terminated_ @@ -95,14 +86,6 @@ extern "C" { return status; } - status = f_string_dynamic_terminate_after(&cache->action.name_file); - - if (F_status_is_error(status)) { - controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true); - - return status; - } - f_string_static_t path = f_string_static_t_initialize; if (global.setting->path_setting.used) { diff --git a/level_3/controller/c/controller/private-controller.h b/level_3/controller/c/controller/private-controller.h index 90e2f3c..01e2541 100644 --- a/level_3/controller/c/controller/private-controller.h +++ b/level_3/controller/c/controller/private-controller.h @@ -43,10 +43,8 @@ extern "C" { * @return * F_none on success. * - * Errors (with error bit) from: f_string_dynamic_terminate_after(). * Errors (with error bit) from: fl_string_dynamic_rip_nulless(). * - * @see f_string_dynamic_terminate_after() * @see fl_string_dynamic_rip_nulless() */ #ifndef _di_controller_string_dynamic_rip_nulless_terminated_ @@ -65,10 +63,8 @@ extern "C" { * F_none on success. * * Errors (with error bit) from: f_string_dynamic_append_nulless(). - * Errors (with error bit) from: f_string_dynamic_terminate_after(). * * @see f_string_dynamic_append_nulless() - * @see f_string_dynamic_terminate_after() */ #ifndef _di_controller_string_dynamic_append_terminated_ extern f_status_t controller_dynamic_append_terminated(const f_string_static_t from, f_string_dynamic_t *destination) F_attribute_visibility_internal_d; @@ -88,10 +84,8 @@ extern "C" { * F_none on success. * * Errors (with error bit) from: f_string_dynamic_append(). - * Errors (with error bit) from: f_string_dynamic_terminate_after(). * * @see f_string_dynamic_append() - * @see f_string_dynamic_terminate_after() */ #ifndef _di_controller_string_dynamic_partial_append_terminated_ extern f_status_t controller_dynamic_partial_append_terminated(const f_string_static_t from, const f_string_range_t range, f_string_dynamic_t *destination) F_attribute_visibility_internal_d; @@ -125,13 +119,11 @@ extern "C" { * Errors (with error bit) from: f_file_stream_open(). * Errors (with error bit) from: f_file_stream_read(). * Errors (with error bit) from: f_string_append(). - * Errors (with error bit) from: f_string_dynamic_terminate_after(). * * @see f_file_stat() * @see f_file_stream_open() * @see f_file_stream_read() * @see f_string_append() - * @see f_string_dynamic_terminate_after() */ #ifndef _di_controller_file_load_ extern f_status_t controller_file_load(const controller_global_t global, const bool required, const f_string_static_t path_prefix, const f_string_static_t path_name, const f_string_static_t path_suffix, controller_cache_t * const cache) F_attribute_visibility_internal_d; diff --git a/level_3/controller/c/entry/private-entry.c b/level_3/controller/c/entry/private-entry.c index f4928ee..f835858 100644 --- a/level_3/controller/c/entry/private-entry.c +++ b/level_3/controller/c/entry/private-entry.c @@ -404,13 +404,6 @@ extern "C" { if (F_status_is_error(status)) { controller_entry_print_error(is_entry, global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, global.thread); } - else { - status = f_string_dynamic_terminate_after(&action->parameters.array[j]); - - if (F_status_is_error(status)) { - controller_entry_print_error(is_entry, global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, global.thread); - } - } } ++action->parameters.used; @@ -473,22 +466,7 @@ extern "C" { } else { if (fl_string_dynamic_compare(action->parameters.array[1], cache->buffer_path) == F_equal_to_not) { - if (global.main->error.verbosity != f_console_verbosity_quiet_e) { - status = f_string_dynamic_terminate_after(&cache->buffer_path); - - if (F_status_is_error(status)) { - controller_entry_print_error(is_entry, global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, global.thread); - - action->status = status; - - if (F_status_set_fine(status) == F_memory_not) { - status_action = status; - } - - break; - } - flockfile(global.main->error.to.stream); fl_print_format("%r%[%QThe %r item action second parameter '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->error.context); @@ -2063,16 +2041,6 @@ extern "C" { } } - status = f_string_dynamic_terminate_after(&cache->action.generic); - - if (F_status_is_error(status)) { - controller_entry_print_error(is_entry, global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, global.thread); - - global.setting->path_control.used = 0; - - break; - } - status = fll_path_canonical(cache->action.generic, &global.setting->path_control); if (F_status_is_error(status)) { diff --git a/level_3/controller/c/entry/private-entry.h b/level_3/controller/c/entry/private-entry.h index f457ba5..338ffa0 100644 --- a/level_3/controller/c/entry/private-entry.h +++ b/level_3/controller/c/entry/private-entry.h @@ -77,14 +77,12 @@ extern "C" { * Errors (with error bit) from: fl_fss_apply_delimit(). * Errors (with error bit) from: f_string_dynamic_partial_append_nulless(). * Errors (with error bit) from: fl_string_dynamic_rip_nulless(). - * Errors (with error bit) from: f_string_dynamic_terminate_after(). * Errors (with error bit) from: f_string_dynamics_increase_by(). * Errors (with error bit) from: fll_fss_extended_read(). * * @see controller_entry_actions_increase_by() * @see f_fss_count_lines() * @see f_string_dynamic_partial_append_nulless() - * @see f_string_dynamic_terminate_after() * @see f_string_dynamics_increase_by() * @see fl_fss_apply_delimit() * @see fl_string_dynamic_rip_nulless() @@ -112,14 +110,12 @@ extern "C" { * * Errors (with error bit) from: macro_f_array_lengths_t_increase_by(). * Errors (with error bit) from: f_string_dynamic_append(). - * Errors (with error bit) from: f_string_dynamic_terminate_after(). * * This will detect and report all errors, but only the first error is returned. * Memory related errors return immediately. * @see macro_f_array_lengths_t_increase_by() * @see f_string_dynamic_append() - * @see f_string_dynamic_terminate_after() */ #ifndef _di_controller_entry_preprocess_ extern f_status_t controller_entry_preprocess(const controller_global_t global, const bool is_entry, controller_cache_t * const cache) F_attribute_visibility_internal_d; diff --git a/level_3/controller/c/entry/private-entry_print.c b/level_3/controller/c/entry/private-entry_print.c index 9a22a96..9c4c42e 100644 --- a/level_3/controller/c/entry/private-entry_print.c +++ b/level_3/controller/c/entry/private-entry_print.c @@ -133,7 +133,7 @@ extern "C" { controller_lock_print(print.to, thread); - fl_print_format("%r%[%Q%s setting%S '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, is_entry ? "Entry" : "Exit", before, print.context); + fl_print_format("%r%[%Q%r setting%S '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, is_entry ? controller_Entry_s : controller_Exit_s, before, print.context); fl_print_format("%[%/Q%]", print.to.stream, print.notable, cache->buffer_file, range, print.notable); fl_print_format("%['%S.%]%r", print.to.stream, print.context, after, print.context, f_string_eol_s); @@ -154,7 +154,7 @@ extern "C" { fl_print_format("%[%Q%]", global.main->error.to.stream, global.main->error.notable, cache.action.name_action, global.main->error.notable); fl_print_format("%[' requires exactly %]", global.main->error.to.stream, global.main->error.context, global.main->error.context); fl_print_format("%[%un%]", global.main->error.to.stream, global.main->error.notable, total, global.main->error.notable); - fl_print_format("%[' %s.%]%r", global.main->error.to.stream, global.main->error.context, total > 1 ? controller_parameters_s : controller_parameter_s, global.main->error.context, f_string_eol_s); + fl_print_format("%[' %r.%]%r", global.main->error.to.stream, global.main->error.context, total > 1 ? controller_parameters_s : controller_parameter_s, global.main->error.context, f_string_eol_s); controller_entry_print_error_cache(is_entry, global.main->error, cache.action); diff --git a/level_3/controller/c/process/private-process.c b/level_3/controller/c/process/private-process.c index 20419e1..ea8d85e 100644 --- a/level_3/controller/c/process/private-process.c +++ b/level_3/controller/c/process/private-process.c @@ -64,15 +64,11 @@ extern "C" { status = f_string_dynamic_append(alias, &process->rule.alias); if (F_status_is_error_not(status)) { - status = f_string_dynamic_terminate_after(&process->rule.alias); + process->id = global.thread->processs.used++; + status = F_none; - if (F_status_is_error_not(status)) { - process->id = global.thread->processs.used++; - status = F_none; - - if (id) { - *id = process->id; - } + if (id) { + *id = process->id; } } diff --git a/level_3/controller/c/process/private-process.h b/level_3/controller/c/process/private-process.h index c818851..4c7ed04 100644 --- a/level_3/controller/c/process/private-process.h +++ b/level_3/controller/c/process/private-process.h @@ -42,13 +42,11 @@ extern "C" { * F_lock (with error bit) if failed to re-establish read lock on global.thread->lock.process while returning. * * Errors (with error bit) from: f_string_dynamic_append(). - * Errors (with error bit) from: f_string_dynamic_terminate_after(). * * Errors (with error bit) from: controller_lock_read(). * Errors (with error bit) from: controller_lock_write(). * * @see f_string_dynamic_append() - * @see f_string_dynamic_terminate_after() * @see controller_lock_read() * @see controller_lock_write() */ diff --git a/level_3/controller/c/rule/private-rule.c b/level_3/controller/c/rule/private-rule.c index 21c98f3..e7e52db 100644 --- a/level_3/controller/c/rule/private-rule.c +++ b/level_3/controller/c/rule/private-rule.c @@ -85,14 +85,6 @@ extern "C" { return status; } - status = f_string_dynamic_terminate_after(¶meters->array[0]); - - if (F_status_is_error(status)) { - controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true); - - return status; - } - ++parameters->used; } @@ -120,14 +112,6 @@ extern "C" { return status; } - status = f_string_dynamic_terminate_after(¶meters->array[parameters->used]); - - if (F_status_is_error(status)) { - controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true); - - return status; - } - ++parameters->used; } // for } @@ -351,12 +335,6 @@ extern "C" { if (F_status_is_error(status)) { controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_string_dynamic_append_nulless", F_true); } - - status = f_string_dynamic_terminate_after(&actions->array[actions->used].parameters.array[0]); - - if (F_status_is_error(status)) { - controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true); - } else { actions->array[actions->used++].parameters.used = 1; } @@ -462,13 +440,6 @@ extern "C" { if (F_status_is_error(status)) { controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "fl_string_dynamic_rip", F_true); } - else { - status = f_string_dynamic_terminate_after(&item->pid_file); - - if (F_status_is_error(status)) { - controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true); - } - } } else if (type == controller_rule_action_type_rerun_e) { uint8_t type_rerun = 0; @@ -660,14 +631,7 @@ extern "C" { controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_string_dynamic_partial_mash_nulless", F_true); } else { - status = f_string_dynamic_terminate_after(&actions->array[actions->used].parameters.array[0]); - - if (F_status_is_error(status)) { - controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true); - } - else { - actions->array[actions->used++].parameters.used = 1; - } + actions->array[actions->used++].parameters.used = 1; } } } @@ -789,8 +753,6 @@ extern "C" { #ifndef _di_controller_rule_copy_ f_status_t controller_rule_copy(const controller_rule_t source, controller_rule_t *destination) { - f_status_t status = F_none; - // Delete the third party structures. macro_f_control_group_t_delete_simple(destination->cgroup) f_capability_delete(&destination->capability); @@ -837,6 +799,8 @@ extern "C" { destination->ons.used = 0; destination->items.used = 0; + f_status_t status = F_none; + if (source.alias.used) { status = f_string_dynamic_append(source.alias, &destination->alias); if (F_status_is_error(status)) return status; @@ -963,9 +927,6 @@ extern "C" { status = f_string_dynamic_append(item_source->pid_file, &item_destination->pid_file); if (F_status_is_error(status)) return status; - status = f_string_dynamic_terminate_after(&item_destination->pid_file); - if (F_status_is_error(status)) return status; - for (j = 0; j < controller_rule_action_type_execute__enum_size_e; ++j) { item_destination->reruns[j].is = item_source->reruns[j].is; item_destination->reruns[j].failure.count = item_source->reruns[j].failure.count; @@ -1867,12 +1828,6 @@ extern "C" { return status; } - status = f_string_dynamic_terminate_after(alias); - - if (F_status_is_error(status)) { - controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true); - } - return status; } #endif // _di_controller_rule_id_construct_ @@ -2263,14 +2218,6 @@ extern "C" { return status; } - status = f_string_dynamic_terminate_after(&process->cache.action.name_file); - - if (F_status_is_error(status)) { - controller_rule_print_error(global.thread, global.main->error, process->cache.action, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, F_true); - - return status; - } - if ((process->options & controller_process_option_simulate_d) && (process->options & controller_process_option_validate_d)) { controller_rule_validate(global, process->rule, process->action, process->options, &process->cache); } @@ -3362,14 +3309,7 @@ extern "C" { controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_string_dynamic_append_nulless", F_true); } else { - status = f_string_dynamic_terminate_after(&rule->alias); - - if (F_status_is_error(status)) { - controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true); - } - else { - status = controller_file_load(global, F_true, controller_rules_s, rule->alias, controller_rule_s, cache); - } + status = controller_file_load(global, F_true, controller_rules_s, rule->alias, controller_rule_s, cache); } if (F_status_is_error_not(status)) { @@ -3490,14 +3430,6 @@ extern "C" { break; } - status = f_string_dynamic_terminate_after(&cache->buffer_item); - - if (F_status_is_error(status)) { - controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true); - - break; - } - if (rule->items.array[rule->items.used].type) { // Initialize the item with settings. @@ -3596,16 +3528,7 @@ extern "C" { if (F_status_is_error(status)) { controller_rule_print_error(global.thread, global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, F_false); - } - else { - status = f_string_dynamic_terminate_after(&cache->action.name_item); - if (F_status_is_error(status)) { - controller_rule_print_error(global.thread, global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, F_false); - } - } - - if (F_status_is_error(status)) { if (F_status_set_fine(status) == F_memory_not) { status_return = status; @@ -3709,16 +3632,6 @@ extern "C" { if (F_status_is_error(status)) { controller_rule_print_error(global.thread, global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, F_false); - } - else { - status = f_string_dynamic_terminate_after(&cache->action.name_action); - - if (F_status_is_error(status)) { - controller_rule_print_error(global.thread, global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, F_false); - } - } - - if (F_status_is_error(status)) { // Get the current line number within the settings item. cache->action.line_item = line_item; @@ -3935,16 +3848,7 @@ extern "C" { if (F_status_is_error(status)) { controller_rule_print_error(global.thread, global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, F_false); - } - else { - status = f_string_dynamic_terminate_after(&setting_maps->array[setting_maps->used].value); - if (F_status_is_error(status)) { - controller_rule_print_error(global.thread, global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, F_false); - } - } - - if (F_status_is_error(status)) { if (F_status_set_fine(status) == F_memory_not) { status_return = status; @@ -4372,16 +4276,7 @@ extern "C" { if (F_status_is_error(status)) { controller_rule_print_error(global.thread, global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, F_false); - } - else { - status = f_string_dynamic_terminate_after(setting_value); - if (F_status_is_error(status)) { - controller_rule_print_error(global.thread, global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, F_false); - } - } - - if (F_status_is_error(status)) { if (F_status_set_fine(status) == F_memory_not) { status_return = status; @@ -4700,35 +4595,6 @@ extern "C" { } } - status = f_string_dynamic_terminate_after(&cache->action.generic); - - if (F_status_is_error(status)) { - - // Get the current line number within the settings item. - cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item); - - cache->action.line_action = ++cache->action.line_item; - - controller_lock_print(global.main->error.to, global.thread); - - controller_rule_print_error(global.thread, global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, F_false); - - controller_rule_print_error_cache(global.main->error, cache->action, F_false); - - controller_unlock_print_flush(global.main->error.to, global.thread); - - if (F_status_set_fine(status) == F_memory_not) { - status_return = status; - - break; - } - - if (F_status_is_error_not(status_return)) { - status_return = F_status_set_error(F_valid_not); - } - } - status = f_capability_from_text(cache->action.generic, &rule->capability); if (F_status_is_error(status) && F_status_set_fine(status) != F_supported_not) { @@ -4827,10 +4693,6 @@ extern "C" { status = f_string_dynamic_partial_append_nulless(cache->buffer_item, cache->content_actions.array[i].array[0], &cache->action.generic); - if (F_status_is_error_not(status)) { - status = f_string_dynamic_terminate_after(&cache->action.generic); - } - if (F_status_is_error(status)) { // Get the current line number within the settings item. @@ -4841,7 +4703,7 @@ extern "C" { controller_lock_print(global.main->error.to, global.thread); - controller_rule_print_error(global.thread, global.main->error, cache->action, F_status_set_fine(status), cache->action.generic.used ? "f_string_dynamic_partial_append_nulless" : "f_string_dynamic_terminate_after", F_true, F_false); + controller_rule_print_error(global.thread, global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, F_false); controller_rule_print_error_cache(global.main->error, cache->action, F_false); @@ -4907,10 +4769,6 @@ extern "C" { status = f_string_dynamic_partial_append_nulless(cache->buffer_item, cache->content_actions.array[i].array[0], &cache->action.generic); - if (F_status_is_error_not(status)) { - status = f_string_dynamic_terminate_after(&cache->action.generic); - } - controller_rule_setting_read_print_value(global, controller_user_s, f_string_empty_s, cache->action.generic, 0); } } @@ -4978,7 +4836,7 @@ extern "C" { } else { - // get the current line number within the settings item. + // Get the current line number within the settings item. cache->action.line_item = line_item; f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item); @@ -5046,16 +4904,7 @@ extern "C" { if (F_status_is_error(status)) { controller_rule_print_error(global.thread, global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, F_false); - } - else { - status = f_string_dynamic_terminate_after(&setting_values->array[setting_values->used]); - if (F_status_is_error(status)) { - controller_rule_print_error(global.thread, global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, F_false); - } - } - - if (F_status_is_error(status)) { setting_values->array[setting_values->used].used = 0; if (F_status_set_fine(status) == F_memory_not) { @@ -5364,7 +5213,7 @@ extern "C" { if (global.main->error.verbosity == f_console_verbosity_debug_e || (global.main->error.verbosity == f_console_verbosity_verbose_e && global.main->parameters.array[controller_parameter_simulate_e].result == f_console_result_found_e)) { controller_lock_print(global.main->output.to, global.thread); - fl_print_format("%rProcessing rule item action '%[%S%]', adding ", global.main->output.to.stream, f_string_eol_s, global.main->context.set.title, controller_on_s, global.main->context.set.title); + fl_print_format("%rProcessing rule item action '%[%r%]', adding ", global.main->output.to.stream, f_string_eol_s, global.main->context.set.title, controller_on_s, global.main->context.set.title); fl_print_format("'%[%/Q%]' of ", global.main->output.to.stream, global.main->context.set.notable, cache->buffer_item, cache->content_actions.array[i].array[1], global.main->context.set.notable); fl_print_format("'%[%/Q%]/", global.main->output.to.stream, global.main->context.set.important, cache->buffer_item, cache->content_actions.array[i].array[2], global.main->context.set.important); fl_print_format("%[%/Q%]'.%r", global.main->output.to.stream, global.main->context.set.important, cache->buffer_item, cache->content_actions.array[i].array[3], global.main->context.set.important, f_string_eol_s); diff --git a/level_3/controller/c/rule/private-rule.h b/level_3/controller/c/rule/private-rule.h index 6713d66..2384a29 100644 --- a/level_3/controller/c/rule/private-rule.h +++ b/level_3/controller/c/rule/private-rule.h @@ -370,11 +370,9 @@ extern "C" { * F_none on success. * * Errors (with error bit) from: f_string_dynamic_partial_append_nulless(). - * Errors (with error bit) from: f_string_dynamic_terminate_after(). * * @see f_string_append() * @see f_string_dynamic_partial_append_nulless() - * @see f_string_dynamic_terminate_after() */ #ifndef _di_controller_rule_id_construct_ extern f_status_t controller_rule_id_construct(const controller_global_t global, const f_string_static_t source, const f_string_range_t directory, const f_string_range_t basename, f_string_dynamic_t * const alias) F_attribute_visibility_internal_d; @@ -437,12 +435,10 @@ extern "C" { * * Errors (with error bit) from: f_fss_count_lines(). * Errors (with error bit) from: f_string_dynamic_partial_append_nulless(). - * Errors (with error bit) from: f_string_dynamic_terminate_after(). * * @see controller_rule_action_read() * @see f_fss_count_lines() * @see f_string_dynamic_partial_append_nulless() - * @see f_string_dynamic_terminate_after() */ #ifndef _di_controller_rule_item_read_ extern f_status_t controller_rule_item_read(const controller_global_t global, const bool is_normal, controller_cache_t * const cache, controller_rule_item_t * const item) F_attribute_visibility_internal_d; @@ -642,7 +638,6 @@ extern "C" { * @see fl_fss_apply_delimit(). * @see f_string_dynamic_partial_append(). * @see f_string_dynamic_partial_append_nulless(). - * @see f_string_dynamic_terminate_after(). * @see fll_fss_basic_list_read(). */ #ifndef _di_controller_rule_read_ diff --git a/level_3/fake/c/private-build-library.c b/level_3/fake/c/private-build-library.c index 9f94f66..aec29a5 100644 --- a/level_3/fake/c/private-build-library.c +++ b/level_3/fake/c/private-build-library.c @@ -540,14 +540,6 @@ extern "C" { break; } - *status = f_string_dynamic_terminate_after(&source_path); - - if (F_status_is_error(*status)) { - fll_error_print(main->error, F_status_set_fine(*status), "f_string_dynamic_terminate_after", F_true); - - break; - } - source.used = source_path.used + file_name.used + fake_build_parameter_object_name_suffix_s.used; } else { diff --git a/level_3/fake/c/private-build-load.c b/level_3/fake/c/private-build-load.c index e065444..3f2cbb6 100644 --- a/level_3/fake/c/private-build-load.c +++ b/level_3/fake/c/private-build-load.c @@ -1046,14 +1046,6 @@ extern "C" { break; } - - *status = f_string_dynamic_terminate_after(settings_single_destination[i]); - - if (F_status_is_error(*status)) { - fll_error_print(main->error, F_status_set_fine(*status), "f_string_dynamic_terminate_after", F_true); - - break; - } } if (!settings_single_source[i]->used) continue; @@ -1206,13 +1198,6 @@ extern "C" { break; } - - *status = f_string_dynamic_terminate_after(settings_single_destination[i]); - if (F_status_is_error(*status)) { - fll_error_print(main->error, F_status_set_fine(*status), "f_string_dynamic_terminate_after", F_true); - - break; - } } } } // for @@ -1312,14 +1297,6 @@ extern "C" { return; } - - *status = f_string_dynamic_terminate_after(&main->path_sources); - - if (F_status_is_error(*status)) { - fll_error_print(main->error, F_status_set_fine(*status), "f_string_dynamic_terminate_after", F_true); - - return; - } } if (main->parameters.array[fake_parameter_shared_disabled_e].result == f_console_result_found_e) { @@ -1511,14 +1488,6 @@ extern "C" { break; } - - *status = f_string_dynamic_terminate_after(values[i]); - - if (F_status_is_error(*status)) { - fll_error_print(main->error, F_status_set_fine(*status), "f_string_dynamic_terminate_after", F_true); - - break; - } } // for f_string_dynamic_resize(0, &settings_file_base); diff --git a/level_3/fake/c/private-build-load.h b/level_3/fake/c/private-build-load.h index 43acce2..02acb93 100644 --- a/level_3/fake/c/private-build-load.h +++ b/level_3/fake/c/private-build-load.h @@ -87,13 +87,11 @@ extern "C" { * Errors (with error bit) from: f_path_directory_cleanup(). * Errors (with error bit) from: f_string_dynamic_append(). * Errors (with error bit) from: f_string_dynamic_increase_by(). - * Errors (with error bit) from: f_string_dynamic_terminate_after(). * Errors (with error bit) from: fll_fss_snatch_apart(). * * @see f_path_directory_cleanup() * @see f_string_dynamic_append() * @see f_string_dynamic_increase_by() - * @see f_string_dynamic_terminate_after() * @see fll_fss_snatch_apart() */ #ifndef _di_fake_build_load_setting_process_ diff --git a/level_3/fake/c/private-build-objects.c b/level_3/fake/c/private-build-objects.c index 8c43639..611a59b 100644 --- a/level_3/fake/c/private-build-objects.c +++ b/level_3/fake/c/private-build-objects.c @@ -101,14 +101,6 @@ extern "C" { break; } - *status = f_string_dynamic_terminate_after(&destination_path); - - if (F_status_is_error(*status)) { - fll_error_print(main->error, F_status_set_fine(*status), "f_string_dynamic_terminate_after", F_true); - - break; - } - *status = f_directory_exists(destination_path); if (*status == F_false) { diff --git a/level_3/fake/c/private-build.c b/level_3/fake/c/private-build.c index 2ebff22..d755c1f 100644 --- a/level_3/fake/c/private-build.c +++ b/level_3/fake/c/private-build.c @@ -409,14 +409,6 @@ extern "C" { break; } - *status = f_string_dynamic_terminate_after(&path_source); - - if (F_status_is_error(*status)) { - fll_error_print(main->error, F_status_set_fine(*status), "f_string_dynamic_terminate_after", F_true); - - break; - } - *status = f_directory_is(path_source); if (*status == F_true) { @@ -438,14 +430,6 @@ extern "C" { break; } - *status = f_string_dynamic_terminate_after(&destination_directory); - - if (F_status_is_error(*status)) { - fll_error_print(main->error, F_status_set_fine(*status), "f_string_dynamic_terminate_after", F_true); - - break; - } - *status = fl_directory_copy(path_source, destination_directory, mode, recurse); if (F_status_is_error(*status)) { @@ -499,14 +483,6 @@ extern "C" { break; } - *status = f_string_dynamic_terminate_after(&destination_directory); - - if (F_status_is_error(*status)) { - fll_error_print(main->error, F_status_set_fine(*status), "f_string_dynamic_terminate_after", F_true); - - break; - } - *status = fl_directory_create(destination_directory, F_file_mode_all_rwx_d); if (F_status_is_error(*status)) { @@ -533,14 +509,6 @@ extern "C" { } } - *status = f_string_dynamic_terminate_after(&destination_file); - - if (F_status_is_error(*status)) { - fll_error_print(main->error, F_status_set_fine(*status), "f_string_dynamic_terminate_after", F_true); - - break; - } - *status = f_file_copy(path_source, destination_file, mode, F_file_default_read_size_d, F_false); if (F_status_is_error(*status)) { @@ -658,17 +626,6 @@ extern "C" { return 0; } - - *status = f_string_dynamic_terminate_after(&defines); - - if (F_status_is_error(*status)) { - fll_error_print(main->error, F_status_set_fine(*status), "f_string_dynamic_terminate_after", F_true); - - f_string_dynamic_resize(0, &defines); - f_string_dynamics_resize(0, &arguments); - - return 0; - } } const f_string_static_t parameters_prefix[] = { @@ -715,32 +672,22 @@ extern "C" { } f_string_dynamic_t path = f_string_dynamic_t_initialize; - f_string_t function = 0; - - { - function = "f_string_dynamic_append_nulless"; - - if (process_script.string[0] != '/') { - *status = f_string_dynamic_append_nulless(main->path_data_build, &path); - } - if (F_status_is_error_not(*status)) { - *status = f_string_dynamic_append_nulless(process_script, &path); - } + if (process_script.string[0] != '/') { + *status = f_string_dynamic_append_nulless(main->path_data_build, &path); + } - if (F_status_is_error_not(*status)) { - function = "f_string_dynamic_terminate_after"; - *status = f_string_dynamic_terminate_after(&path); - } + if (F_status_is_error_not(*status)) { + *status = f_string_dynamic_append_nulless(process_script, &path); + } - if (F_status_is_error(*status)) { - fll_error_print(main->error, F_status_set_fine(*status), function, F_true); + if (F_status_is_error(*status)) { + fll_error_print(main->error, F_status_set_fine(*status), "f_string_dynamic_append_nulless", F_true); - f_string_dynamic_resize(0, &path); - f_string_dynamics_resize(0, &arguments); + f_string_dynamic_resize(0, &path); + f_string_dynamics_resize(0, &arguments); - return 0; - } + return 0; } int return_code = 0; @@ -813,14 +760,6 @@ extern "C" { } } // for - status = f_string_dynamic_terminate_after(name); - - if (F_status_is_error(status)) { - fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true); - - return status; - } - return F_none; } #endif // _di_fake_build_get_file_name_without_extension_ diff --git a/level_3/fake/c/private-fake-path_generate.c b/level_3/fake/c/private-fake-path_generate.c index 830a122..3c94724 100644 --- a/level_3/fake/c/private-fake-path_generate.c +++ b/level_3/fake/c/private-fake-path_generate.c @@ -352,61 +352,6 @@ extern "C" { } } - { - f_string_dynamic_t * const parameters_value[] = { - &main->path_build_documents, - &main->path_build_includes, - &main->path_build_libraries, - &main->path_build_libraries_script, - &main->path_build_libraries_shared, - &main->path_build_libraries_static, - &main->path_build_objects, - &main->path_build_objects_script, - &main->path_build_objects_shared, - &main->path_build_objects_static, - &main->path_build_programs, - &main->path_build_programs_script, - &main->path_build_programs_shared, - &main->path_build_programs_static, - &main->path_build_settings, - &main->path_build_stage, - &main->path_data_build, - &main->path_data_settings, - &main->path_documents, - &main->path_licenses, - &main->path_sources, - &main->path_work_includes, - &main->path_work_libraries, - &main->path_work_libraries_script, - &main->path_work_libraries_shared, - &main->path_work_libraries_static, - &main->path_work_programs, - &main->path_work_programs_script, - &main->path_work_programs_shared, - &main->path_work_programs_static, - &main->file_data_build_defines, - &main->file_data_build_dependencies, - &main->file_data_build_process_post_s, - &main->file_data_build_process_pre_s, - &main->file_data_build_fakefile, - &main->file_data_build_settings, - &main->file_documents_readme, - }; - - for (i = 0; i < 37; ++i) { - - if (!parameters_value[i]->used) continue; - - status = f_string_dynamic_terminate_after(parameters_value[i]); - - if (F_status_is_error(status)) { - fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true); - - return status; - } - } // for - } - return F_none; } #endif // _di_fake_path_generate_ diff --git a/level_3/fake/c/private-fake.c b/level_3/fake/c/private-fake.c index 89e94e0..fc7f308 100644 --- a/level_3/fake/c/private-fake.c +++ b/level_3/fake/c/private-fake.c @@ -313,14 +313,6 @@ extern "C" { return status; } } - - status = f_string_dynamic_terminate_after(parameters_value[i]); - - if (F_status_is_error(status)) { - fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true); - - return status; - } } // for } @@ -424,14 +416,6 @@ extern "C" { return status; } } - - status = f_string_dynamic_terminate_after(parameters_value[i]); - - if (F_status_is_error(status)) { - fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true); - - return status; - } } // for } diff --git a/level_3/fake/c/private-make-load_fakefile.c b/level_3/fake/c/private-make-load_fakefile.c index a775669..f935afb 100644 --- a/level_3/fake/c/private-make-load_fakefile.c +++ b/level_3/fake/c/private-make-load_fakefile.c @@ -225,20 +225,10 @@ extern "C" { } if (F_status_is_error_not(*status)) { - function_name = "f_string_dynamic_terminate_after"; - *status = f_string_dynamic_terminate_after(&data_make->setting_make.parameter.array[0].name); - } - - if (F_status_is_error_not(*status)) { function_name = "f_string_dynamics_resize"; *status = f_string_dynamics_resize(1, &data_make->setting_make.parameter.array[0].value); } - if (F_status_is_error_not(*status)) { - function_name = "f_string_dynamic_terminate_after"; - *status = f_string_dynamic_terminate_after(&data_make->setting_make.parameter.array[0].value.array[0]); - } - if (F_status_is_error(*status)) { fll_error_print(data_make->main->error, F_status_set_fine(*status), function_name, F_true); @@ -447,14 +437,6 @@ extern "C" { if (F_status_is_error(status)) break; - status = f_string_dynamic_terminate_after(&combined); - - if (F_status_is_error(status)) { - fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true); - - break; - } - status = f_environment_set(define.array[i].name, combined, F_true); if (F_status_is_error(status)) { @@ -511,14 +493,6 @@ extern "C" { break; } - status = f_string_dynamic_terminate_after(&name_define); - - if (F_status_is_error(status)) { - fll_error_print(data_make->main->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true); - - break; - } - // The environment settings are stored in the build settings rather than the make settings. if (fake_make_operate_validate_define_name(name_define) == F_true) { for (j = 0; j < data_make->setting_build.environment.used; ++j) { @@ -552,14 +526,6 @@ extern "C" { break; } - status = f_string_dynamic_terminate_after(&data_make->setting_build.environment.array[data_make->setting_build.environment.used]); - - if (F_status_is_error(status)) { - fll_error_print(data_make->main->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true); - - break; - } - ++data_make->setting_build.environment.used; } else if (data_make->main->warning.verbosity == f_console_verbosity_verbose_e) { @@ -672,14 +638,6 @@ extern "C" { break; } - status = f_string_dynamic_terminate_after(&data_make->setting_make.parameter.array[0].value.array[0]); - - if (F_status_is_error(status)) { - fll_error_print(data_make->main->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true); - - break; - } - status = f_string_dynamic_append_assure(f_string_space_s, &data_make->setting_make.parameter.array[0].value.array[0]); if (F_status_is_error(status)) { diff --git a/level_3/fake/c/private-make-load_fakefile.h b/level_3/fake/c/private-make-load_fakefile.h index b6a01b9..d452b80 100644 --- a/level_3/fake/c/private-make-load_fakefile.h +++ b/level_3/fake/c/private-make-load_fakefile.h @@ -81,12 +81,10 @@ extern "C" { * * Errors (with error bit) from: f_environment_set(). * Errors (with error bit) from: f_string_dynamic_mash_nulless(). - * Errors (with error bit) from: f_string_dynamic_terminate_after(). * Errors (with error bit) from: fll_fss_snatch_map_apart(). * * @see f_environment_set() * @see f_string_dynamic_mash_nulless() - * @see f_string_dynamic_terminate_after() * @see fll_fss_snatch_map_apart() */ #ifndef _di_fake_make_load_fakefile_setting_define_and_parameter_ @@ -106,12 +104,10 @@ extern "C" { * * Errors (with error bit) from: f_string_dynamic_append(). * Errors (with error bit) from: f_string_dynamic_partial_append_nulless(). - * Errors (with error bit) from: f_string_dynamic_terminate_after(). * Errors (with error bit) from: f_string_dynamics_increase(). * * @see f_string_dynamic_append() * @see f_string_dynamic_partial_append_nulless() - * @see f_string_dynamic_terminate_after() * @see f_string_dynamics_increase() */ #ifndef _di_fake_make_load_fakefile_setting_environment_ @@ -168,11 +164,9 @@ extern "C" { * * Errors (with error bit) from: f_string_append_assure(). * Errors (with error bit) from: f_string_dynamic_partial_append_nulless(). - * Errors (with error bit) from: f_string_dynamic_terminate_after(). * * @see f_string_append_assure() * @see f_string_dynamic_partial_append_nulless() - * @see f_string_dynamic_terminate_after() * * @see fake_make_load_fakefile_setting_define_and_parameter() */ diff --git a/level_3/fake/c/private-make-operate.c b/level_3/fake/c/private-make-operate.c index 2d3ced1..62d3428 100644 --- a/level_3/fake/c/private-make-operate.c +++ b/level_3/fake/c/private-make-operate.c @@ -522,14 +522,6 @@ extern "C" { } } - *status = f_string_dynamic_terminate_after(&arguments->array[arguments->used]); - - if (F_status_is_error(*status)) { - fll_error_print(data_make->error, F_status_set_fine(*status), "f_string_dynamic_terminate_after", F_true); - - break; - } - // Unquoted empty Content after IKI variable substitution are not used as an argument. if (used_content < arguments->array[arguments->used].used || quotes.array[i]) { ++arguments->used; @@ -544,14 +536,6 @@ extern "C" { break; } - *status = f_string_dynamic_terminate_after(&arguments->array[arguments->used]); - - if (F_status_is_error(*status)) { - fll_error_print(data_make->error, F_status_set_fine(*status), "f_string_dynamic_terminate_after", F_true); - - break; - } - ++arguments->used; } @@ -815,11 +799,7 @@ extern "C" { status = f_string_dynamic_append_nulless(value, &arguments->array[arguments->used]); if (F_status_is_error_not(status)) { - status = f_string_dynamic_terminate_after(&arguments->array[arguments->used]); - - if (F_status_is_error_not(status)) { - ++arguments->used; - } + ++arguments->used; } } } @@ -882,11 +862,7 @@ extern "C" { status = f_string_dynamic_append_nulless(*context, &arguments->array[arguments->used]); if (F_status_is_error_not(status)) { - status = f_string_dynamic_terminate_after(&arguments->array[arguments->used]); - - if (F_status_is_error_not(status)) { - ++arguments->used; - } + ++arguments->used; } } } @@ -913,10 +889,6 @@ extern "C" { } if (F_status_is_error_not(status)) { - status = f_string_dynamic_terminate_after(&data_make->cache_1); - } - - if (F_status_is_error_not(status)) { status = f_environment_get(data_make->cache_1, &data_make->cache_2); } @@ -933,10 +905,6 @@ extern "C" { status = f_string_dynamic_append_nulless(data_make->cache_2, &arguments->array[arguments->used]); } - if (F_status_is_error_not(status)) { - status = f_string_dynamic_terminate_after(&arguments->array[arguments->used]); - } - if (F_status_is_error(status)) return status; if (!quoted) { diff --git a/level_3/fake/c/private-make-operate.h b/level_3/fake/c/private-make-operate.h index 85c9eae..7580b10 100644 --- a/level_3/fake/c/private-make-operate.h +++ b/level_3/fake/c/private-make-operate.h @@ -101,13 +101,11 @@ extern "C" { * Errors (with error bit) from: f_string_dynamic_append_nulless(). * Errors (with error bit) from: f_string_dynamic_partial_append_nulless(). * Errors (with error bit) from: f_string_dynamic_increase_by(). - * Errors (with error bit) from: f_string_dynamic_terminate_after(). * Errors (with error bit) from: f_string_dynamics_increase(). * * @see f_string_dynamic_append_nulless() * @see f_string_dynamic_partial_append_nulless() * @see f_string_dynamic_increase_by() - * @see f_string_dynamic_terminate_after() * @see f_string_dynamics_increase() */ #ifndef _di_fake_make_operate_expand_environment_ diff --git a/level_3/fake/c/private-make-operate_process.c b/level_3/fake/c/private-make-operate_process.c index f051614..37ff28d 100644 --- a/level_3/fake/c/private-make-operate_process.c +++ b/level_3/fake/c/private-make-operate_process.c @@ -637,14 +637,6 @@ extern "C" { return status; } - status = f_string_dynamic_terminate_after(&data_make->setting_make.parameter.array[0].value.array[0]); - - if (F_status_is_error(status)) { - fll_error_print(data_make->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true); - - return status; - } - if (data_make->error.verbosity != f_console_verbosity_quiet_e && data_make->error.to.stream) { flockfile(data_make->error.to.stream); diff --git a/level_3/fake/c/private-make-operate_process.h b/level_3/fake/c/private-make-operate_process.h index 65be39c..ee39783 100644 --- a/level_3/fake/c/private-make-operate_process.h +++ b/level_3/fake/c/private-make-operate_process.h @@ -85,12 +85,10 @@ extern "C" { * Errors (with error bit) from: f_conversion_number_signed_to_string(). * Errors (with error bit) from: f_string_append(). * Errors (with error bit) from: f_string_dynamic_append(). - * Errors (with error bit) from: f_string_dynamic_terminate_after(). * * @see f_conversion_number_signed_to_string() * @see f_string_append() * @see f_string_dynamic_append() - * @see f_string_dynamic_terminate_after() */ #ifndef _di_fake_make_operate_process_return_ extern f_status_t fake_make_operate_process_return(fake_make_data_t * const data_make, const int return_code) F_attribute_visibility_internal_d; diff --git a/level_3/fake/c/private-make-operate_process_type.c b/level_3/fake/c/private-make-operate_process_type.c index cd91f4d..38ae4db 100644 --- a/level_3/fake/c/private-make-operate_process_type.c +++ b/level_3/fake/c/private-make-operate_process_type.c @@ -1184,14 +1184,6 @@ extern "C" { return status; } - status = f_string_dynamic_terminate_after(&data_make->setting_make.parameter.array[data_make->setting_make.parameter.used].name); - - if (F_status_is_error(status)) { - fll_error_print(data_make->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true); - - return status; - } - i = data_make->setting_make.parameter.used++; } diff --git a/level_3/fake/c/private-make-operate_process_type.h b/level_3/fake/c/private-make-operate_process_type.h index 3c002e6..4be8a14 100644 --- a/level_3/fake/c/private-make-operate_process_type.h +++ b/level_3/fake/c/private-make-operate_process_type.h @@ -377,12 +377,10 @@ extern "C" { * F_none on success. * * Errors (with error bit) from: f_string_dynamic_resize(). - * Errors (with error bit) from: f_string_dynamic_terminate_after(). * Errors (with error bit) from: f_string_dynamics_resize(). * Errors (with error bit) from: f_string_map_multis_resize(). * * @see f_string_dynamic_resize() - * @see f_string_dynamic_terminate_after() * @see f_string_dynamics_resize() * @see f_string_map_multis_resize() */ diff --git a/level_3/firewall/c/firewall.c b/level_3/firewall/c/firewall.c index 9a11a9b..446a327 100644 --- a/level_3/firewall/c/firewall.c +++ b/level_3/firewall/c/firewall.c @@ -609,10 +609,6 @@ extern "C" { status = f_string_dynamic_append(firewall_file_suffix_s, &path_file); } - if (F_status_is_error_not(status)) { - status = f_string_dynamic_terminate_after(&path_file); - } - if (F_status_is_error(status)) { firewall_print_error_on_allocation_failure(main->error); diff --git a/level_3/firewall/c/private-firewall.c b/level_3/firewall/c/private-firewall.c index 7babe70..df1d5e0 100644 --- a/level_3/firewall/c/private-firewall.c +++ b/level_3/firewall/c/private-firewall.c @@ -46,10 +46,6 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal status = f_string_dynamic_append(main->devices.array[local.device], &device); - if (F_status_is_error_not(status)) { - status = f_string_dynamic_terminate_after(&device); - } - if (F_status_is_error(status)) { if (F_status_set_fine(status) == F_memory_not) { firewall_print_error_on_allocation_failure(main->error); @@ -194,10 +190,6 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal if (length) { status = f_string_dynamic_partial_append(local.buffer, local.rule_contents.array[i].array[0], &device); - if (F_status_is_error_not(status)) { - status = f_string_dynamic_terminate_after(&device); - } - if (F_status_is_error(status)) break; } @@ -263,10 +255,6 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal status = f_string_dynamic_partial_append(local.buffer, local.rule_contents.array[i].array[0], &protocol); - if (F_status_is_error_not(status)) { - status = f_string_dynamic_terminate_after(&protocol); - } - if (F_status_is_error(status)) break; use_protocol = F_true; @@ -383,10 +371,6 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal status = f_string_dynamic_append(firewall_action_policy_command_s, &arguments.array[arguments.used]); } - if (F_status_is_error_not(status)) { - status = f_string_dynamic_terminate_after(&arguments.array[arguments.used]); - } - if (F_status_is_error(status)) break; if (action == firewall_action_append_id_e || action == firewall_action_insert_id_e || action == firewall_action_policy_id_e) { @@ -418,10 +402,6 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal status = f_string_dynamic_append(firewall_chain_output_s, &arguments.array[arguments.used]); } - if (F_status_is_error_not(status)) { - status = f_string_dynamic_terminate_after(&arguments.array[arguments.used]); - } - if (F_status_is_error(status)) break; if (status == F_data_not) { @@ -445,10 +425,6 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal if (direction == firewall_direction_input_id_e) { status = f_string_dynamic_append(firewall_device_input_command_s, &arguments.array[arguments.used]); - if (F_status_is_error_not(status)) { - status = f_string_dynamic_terminate_after(&arguments.array[arguments.used]); - } - if (F_status_is_error(status)) break; ++arguments.used; @@ -456,10 +432,6 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal else if (direction == firewall_direction_output_id_e) { status = f_string_dynamic_append(firewall_device_output_command_s, &arguments.array[arguments.used]); - if (F_status_is_error_not(status)) { - status = f_string_dynamic_terminate_after(&arguments.array[arguments.used]); - } - if (F_status_is_error(status)) break; ++arguments.used; @@ -475,10 +447,6 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal status = f_string_dynamic_append(device, &arguments.array[arguments.used]); - if (F_status_is_error_not(status)) { - status = f_string_dynamic_terminate_after(&arguments.array[arguments.used]); - } - if (F_status_is_error(status)) break; ++arguments.used; @@ -493,10 +461,6 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal status = f_string_dynamic_append(firewall_protocol_command_s, &arguments.array[arguments.used]); - if (F_status_is_error_not(status)) { - status = f_string_dynamic_terminate_after(&arguments.array[arguments.used]); - } - if (F_status_is_error(status)) break; ++arguments.used; @@ -509,10 +473,6 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal status = f_string_dynamic_append(protocol, &arguments.array[arguments.used]); - if (F_status_is_error_not(status)) { - status = f_string_dynamic_terminate_after(&arguments.array[arguments.used]); - } - if (F_status_is_error(status)) break; ++arguments.used; @@ -535,10 +495,6 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal status = f_string_dynamic_partial_append(local.buffer, local.rule_contents.array[i].array[subcounter], &ip_list); - if (F_status_is_error_not(status)) { - status = f_string_dynamic_terminate_after(&ip_list); - } - if (F_status_is_error(status)) { // Prevent the loop below from being processed. @@ -558,11 +514,6 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal arguments.array[arguments.used].used = 0; status = f_string_dynamic_partial_append(local.buffer, local.rule_contents.array[i].array[subcounter], &arguments.array[arguments.used]); - - if (F_status_is_error_not(status)) { - status = f_string_dynamic_terminate_after(&arguments.array[arguments.used]); - } - if (F_status_is_error(status)) break; ++arguments.used; @@ -726,11 +677,6 @@ f_status_t firewall_perform_commands(firewall_main_t * const main, const firewal arguments.array[arguments.used].used = 0; status = f_string_dynamic_partial_append(local_buffer, basic_objects.array[at], &arguments.array[arguments.used]); - - if (F_status_is_error_not(status)) { - status = f_string_dynamic_terminate_after(&arguments.array[arguments.used]); - } - if (F_status_is_error(status)) break; ++arguments.used; @@ -857,14 +803,9 @@ f_status_t firewall_create_custom_chains(firewall_main_t * const main, firewall_ status = f_string_dynamic_append(firewall_chain_create_command_s, &arguments.array[0]); if (F_status_is_error_not(status)) { - status = f_string_dynamic_terminate_after(&arguments.array[0]); - } - - if (F_status_is_error_not(status)) { status = f_string_dynamic_increase(F_memory_default_allocation_small_d, &arguments.array[1]); } - - if (F_status_is_error(status)) { + else { f_string_dynamics_resize(0, &arguments); return status; -- 1.8.3.1