Skip to content

Commit

Permalink
Bug 798810 - Income Statement (multicolumn) - account sorting is...
Browse files Browse the repository at this point in the history
'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.
  • Loading branch information
jralls committed Mar 31, 2023
1 parent a2098b3 commit 634b9f8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions bindings/guile/gnc-optiondb.i
Expand Up @@ -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))
{
Expand All @@ -491,6 +494,8 @@ scm_to_value<GncOptionAccountList>(SCM new_value)
}
next = scm_cdr(next);
}

std::reverse(retval.begin(), retval.end());
return retval;
}

Expand Down

0 comments on commit 634b9f8

Please sign in to comment.