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.
This commit is contained in:
John Ralls 2023-03-31 16:43:42 -07:00
parent a2098b383c
commit 634b9f8744

View File

@ -466,6 +466,9 @@ scm_to_value<GncOptionAccountList>(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<GncOptionAccountList>(SCM new_value)
}
next = scm_cdr(next);
}
std::reverse(retval.begin(), retval.end());
return retval;
}