From c1ee59c39bf5287f30dc2ef489b5f4b71db66029 Mon Sep 17 00:00:00 2001 From: Christopher Lam Date: Sun, 14 Apr 2024 16:17:42 +0800 Subject: [PATCH] [Account.h] size_t xaccAccountGetSplitsSize returns g_list_length (splits) which is easily replaced with vector.size() --- libgnucash/engine/Account.cpp | 5 +++++ libgnucash/engine/Account.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/libgnucash/engine/Account.cpp b/libgnucash/engine/Account.cpp index b456da0563..052bc7e241 100644 --- a/libgnucash/engine/Account.cpp +++ b/libgnucash/engine/Account.cpp @@ -4048,6 +4048,11 @@ xaccAccountGetSplitList (const Account *acc) return GET_PRIVATE(acc)->splits; } +size_t +xaccAccountGetSplitsSize (const Account *account) +{ + return GNC_IS_ACCOUNT(account) ? g_list_length (GET_PRIVATE(account)->splits) : 0; +} gboolean gnc_account_and_descendants_empty (Account *acc) { diff --git a/libgnucash/engine/Account.h b/libgnucash/engine/Account.h index daac6b52af..83fa8d3901 100644 --- a/libgnucash/engine/Account.h +++ b/libgnucash/engine/Account.h @@ -1060,6 +1060,8 @@ typedef enum */ SplitList* xaccAccountGetSplitList (const Account *account); + size_t xaccAccountGetSplitsSize (const Account *account); + /** The xaccAccountMoveAllSplits() routine reassigns each of the splits * in accfrom to accto. */ void xaccAccountMoveAllSplits (Account *accfrom, Account *accto);