From cd097d19ec7c9e32393f3be69ad7a71e4633d74d Mon Sep 17 00:00:00 2001 From: Christopher Lam Date: Tue, 18 Jun 2024 08:24:17 +0800 Subject: [PATCH] [Account.cpp] don't copy SplitsVec --- libgnucash/engine/Account.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libgnucash/engine/Account.cpp b/libgnucash/engine/Account.cpp index 94dd328681..462a4be51f 100644 --- a/libgnucash/engine/Account.cpp +++ b/libgnucash/engine/Account.cpp @@ -1145,7 +1145,7 @@ gnc_account_foreach_split (const Account *acc, std::function func, if (!GNC_IS_ACCOUNT (acc)) return; - auto splits{GET_PRIVATE(acc)->splits}; + auto& splits{GET_PRIVATE(acc)->splits}; if (reverse) std::for_each(splits.rbegin(), splits.rend(), func); else @@ -1162,7 +1162,7 @@ gnc_account_foreach_split_until_date (const Account *acc, time64 end_date, auto after_date = [](time64 end_date, auto s) -> bool { return (xaccTransGetDate (xaccSplitGetParent (s)) > end_date); }; - auto splits{GET_PRIVATE(acc)->splits}; + auto& splits{GET_PRIVATE(acc)->splits}; auto after_date_iter = std::upper_bound (splits.begin(), splits.end(), end_date, after_date); std::for_each (splits.begin(), after_date_iter, f); } @@ -1175,7 +1175,7 @@ gnc_account_find_split (const Account *acc, std::function pr if (!GNC_IS_ACCOUNT (acc)) return nullptr; - auto splits{GET_PRIVATE(acc)->splits}; + const auto& splits{GET_PRIVATE(acc)->splits}; if (reverse) { auto latest = std::find_if(splits.rbegin(), splits.rend(), predicate); @@ -5550,7 +5550,7 @@ xaccAccountStagedTransactionTraversal (const Account *acc, { if (!acc) return 0; - auto splits = GET_PRIVATE(acc)->splits; + auto& splits = GET_PRIVATE(acc)->splits; for (auto s : splits) { auto trans = s->parent;