From bbe8ebbc15eb64b92a1f0e1d526270e136f801f0 Mon Sep 17 00:00:00 2001 From: John Ralls Date: Tue, 17 Aug 2021 15:38:07 -0700 Subject: [PATCH] Reserve space for the accounts in their vector. Instead of creating an empty vector and then adding the accounts to the end of it. --- gnucash/gnome-utils/dialog-options.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gnucash/gnome-utils/dialog-options.cpp b/gnucash/gnome-utils/dialog-options.cpp index b31810fecc..ee14d4934a 100644 --- a/gnucash/gnome-utils/dialog-options.cpp +++ b/gnucash/gnome-utils/dialog-options.cpp @@ -1653,7 +1653,8 @@ public: { auto widget{GNC_TREE_VIEW_ACCOUNT(get_widget())}; auto acc_list = gnc_tree_view_account_get_selected_accounts(widget); - GncOptionAccountList acc_vec(g_list_length(acc_list)); + GncOptionAccountList acc_vec; + acc_vec.reserve(g_list_length(acc_list)); for (auto node = acc_list; node; node = g_list_next(node)) acc_vec.push_back(static_cast(node->data)); g_list_free(acc_list);