From: Kevin Day Date: Sun, 4 Aug 2024 06:06:00 +0000 (-0500) Subject: Update: Reduce memory usage by fl_fss_basic_content_read() in some circumstances. X-Git-Tag: 0.6.11~9 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=2c0f62c1226b55b9fb546963e4751bd9c82a245b;p=fll Update: Reduce memory usage by fl_fss_basic_content_read() in some circumstances. The fl_fss_basic_content_read() is simple enough that the allocation of the found array is only needed on success. --- diff --git a/level_1/fl_fss/c/fss/basic.c b/level_1/fl_fss/c/fss/basic.c index 7ef47cb..c7c0e92 100644 --- a/level_1/fl_fss/c/fss/basic.c +++ b/level_1/fl_fss/c/fss/basic.c @@ -26,11 +26,7 @@ extern "C" { if (status == F_none_eos) return F_data_not_eos; if (status == F_none_stop) return F_data_not_stop; - status = f_string_ranges_increase(state.step_small, found); - if (F_status_is_error(status)) return status; - const f_number_unsigned_t begin = range->start; - found->array[found->used].start = range->start; for (;; ++range->start) { @@ -53,6 +49,8 @@ extern "C" { if (F_status_is_error(status)) return status; + status = f_string_ranges_increase(state.step_small, found); + if (range->start > begin) { found->array[found->used++].stop = range->start - 1; }