Skip to content

Commit

Permalink
[Account.h] size_t xaccAccountGetSplitsSize returns g_list_length (sp…
Browse files Browse the repository at this point in the history
…lits)

which is easily replaced with vector.size()
  • Loading branch information
christopherlam committed Apr 14, 2024
1 parent f08e0f5 commit c1ee59c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions libgnucash/engine/Account.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
2 changes: 2 additions & 0 deletions libgnucash/engine/Account.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit c1ee59c

Please sign in to comment.