From: Kevin Day Date: Tue, 24 Jan 2023 05:35:53 +0000 (-0600) Subject: Cleanup: Reorder logic in FSS Basic Read function. X-Git-Tag: 0.6.4~84 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=3dc264dbd2c5337d1ce71d314736bc273a33689a;p=fll Cleanup: Reorder logic in FSS Basic Read function. --- diff --git a/level_1/fl_fss/c/private-fss.c b/level_1/fl_fss/c/private-fss.c index c25535f..0775d47 100644 --- a/level_1/fl_fss/c/private-fss.c +++ b/level_1/fl_fss/c/private-fss.c @@ -273,48 +273,7 @@ extern "C" { } // Identify where the object ends. - if (!quote_found) { - status = F_none; - - while (range->start <= range->stop && range->start < buffer.used) { - - if (state.interrupt) { - status = state.interrupt((void *) &state, 0); - - if (F_status_set_fine(status) == F_interrupt) { - status = F_status_set_error(F_interrupt); - - break; - } - } - - status = f_fss_is_space(state, buffer, *range); - if (F_status_is_error(status)) return status; - - if (status == F_true) break; - - status = f_utf_buffer_increment(buffer, range, 1); - if (F_status_is_error(status)) break; - } // while - - if (F_status_is_error(status)) return status; - - found->stop = range->start - 1; - - if (buffer.string[range->start] == f_fss_eol_s.string[0]) { - - // Move the start position to after the EOL. - ++range->start; - - return F_fss_found_object_content_not; - } - - status = f_utf_buffer_increment(buffer, range, 1); - if (F_status_is_error(status)) return status; - - return F_fss_found_object; - } - else { + if (quote_found) { f_array_length_t first_slash = 0; f_array_length_t slash_count = 0; f_array_length_t location = 0; @@ -682,6 +641,47 @@ extern "C" { return F_end_not_group_stop; } } + else { + status = F_none; + + while (range->start <= range->stop && range->start < buffer.used) { + + if (state.interrupt) { + status = state.interrupt((void *) &state, 0); + + if (F_status_set_fine(status) == F_interrupt) { + status = F_status_set_error(F_interrupt); + + break; + } + } + + status = f_fss_is_space(state, buffer, *range); + if (F_status_is_error(status)) return status; + + if (status == F_true) break; + + status = f_utf_buffer_increment(buffer, range, 1); + if (F_status_is_error(status)) break; + } // while + + if (F_status_is_error(status)) return status; + + found->stop = range->start - 1; + + if (buffer.string[range->start] == f_fss_eol_s.string[0]) { + + // Move the start position to after the EOL. + ++range->start; + + return F_fss_found_object_content_not; + } + + status = f_utf_buffer_increment(buffer, range, 1); + if (F_status_is_error(status)) return status; + + return F_fss_found_object; + } // Seek to the EOL when no valid object is found. status = f_fss_seek_to_eol(state, buffer, range);