From 634b9f87449f2253131169bf6b142385d26974e1 Mon Sep 17 00:00:00 2001 From: John Ralls Date: Fri, 31 Mar 2023 16:43:42 -0700 Subject: [PATCH] Bug 798810 - Income Statement (multicolumn) - account sorting is... 'reversed' each time you restart. Lists read from the front, vectors to the back, so reverse the vector after loading it. While we're at it reserve enough elements to hold the list. --- bindings/guile/gnc-optiondb.i | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bindings/guile/gnc-optiondb.i b/bindings/guile/gnc-optiondb.i index 0740947c802..ee443782ffd 100644 --- a/bindings/guile/gnc-optiondb.i +++ b/bindings/guile/gnc-optiondb.i @@ -466,6 +466,9 @@ scm_to_value(SCM new_value) GncOptionAccountList retval{}; if (scm_is_false(scm_list_p(new_value)) || scm_is_null(new_value)) return retval; + + retval.reserve(scm_to_size_t(scm_length(new_value))); + auto next{new_value}; while (!scm_is_null(next) && scm_car(next)) { @@ -491,6 +494,8 @@ scm_to_value(SCM new_value) } next = scm_cdr(next); } + + std::reverse(retval.begin(), retval.end()); return retval; }