From: Kevin Day Date: Tue, 27 Aug 2024 04:30:19 +0000 (-0500) Subject: Cleanup: FSS Extended List function variable names and code structure. X-Git-Tag: 0.6.12~22 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=43b918c23a8f197eed6f90267b783bd8ec21b54d;p=fll Cleanup: FSS Extended List function variable names and code structure. Make the variable name more explicit. This variable name also matches recent 0.7 branch changes. Move the allocation for the comments range after setting all of the variables. This should better allow for determining the state should the `f_string_ranges_increase()` fail. --- diff --git a/level_1/fl_fss/c/fss/extended_list.c b/level_1/fl_fss/c/fss/extended_list.c index 875f104..2823d30 100644 --- a/level_1/fl_fss/c/fss/extended_list.c +++ b/level_1/fl_fss/c/fss/extended_list.c @@ -31,7 +31,7 @@ extern "C" { f_array_length_t newline_last = range->start; f_array_length_t slash_first = 0; f_array_length_t slash_count = 0; - f_array_length_t start = 0; + f_array_length_t comment_start = 0; // Identify where the content ends. while (range->start <= range->stop && range->start < buffer.used) { @@ -187,19 +187,11 @@ extern "C" { if (buffer.string[range->start] == f_fss_comment_s.string[0]) { // The newline_last is initialized to the range->start, which may not actually be a new line. - if (buffer.string[newline_last] == f_string_eol_s.string[0]) { - start = newline_last + 1; - } - else { - start = newline_last; - } + comment_start = (buffer.string[newline_last] == f_string_eol_s.string[0]) ? newline_last + 1 : newline_last; status = f_fss_seek_to_eol(state, buffer, range); if (F_status_is_error(status)) break; - status = f_string_ranges_increase(state.step_small, comments); - if (F_status_is_error(status)) break; - if (range->start > range->stop || range->start >= buffer.used) { --range->start; } @@ -207,7 +199,10 @@ extern "C" { newline_last = range->start; } - comments->array[comments->used].start = start; + status = f_string_ranges_increase(state.step_small, comments); + if (F_status_is_error(status)) break; + + comments->array[comments->used].start = comment_start; comments->array[comments->used++].stop = range->start++; continue;