mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
[account.cpp] rewrite gnc_account_foreach_descendant_until in C++
This commit is contained in:
parent
17953441cb
commit
67bd513514
@ -3153,28 +3153,24 @@ gnc_account_foreach_descendant_until (const Account *acc,
|
||||
AccountCb2 thunk,
|
||||
gpointer user_data)
|
||||
{
|
||||
const AccountPrivate *priv;
|
||||
GList *node;
|
||||
Account *child;
|
||||
gpointer result;
|
||||
gpointer result {nullptr};
|
||||
|
||||
g_return_val_if_fail(GNC_IS_ACCOUNT(acc), NULL);
|
||||
g_return_val_if_fail(thunk, NULL);
|
||||
g_return_val_if_fail (GNC_IS_ACCOUNT(acc), nullptr);
|
||||
g_return_val_if_fail (thunk, nullptr);
|
||||
|
||||
priv = GET_PRIVATE(acc);
|
||||
for (node = priv->children; node; node = node->next)
|
||||
auto priv{GET_PRIVATE(acc)};
|
||||
|
||||
for (auto node = priv->children; node; node = node->next)
|
||||
{
|
||||
child = static_cast<Account*>(node->data);
|
||||
result = thunk(child, user_data);
|
||||
if (result)
|
||||
return(result);
|
||||
auto child = static_cast<Account*>(node->data);
|
||||
result = thunk (child, user_data);
|
||||
if (result) break;
|
||||
|
||||
result = gnc_account_foreach_descendant_until(child, thunk, user_data);
|
||||
if (result)
|
||||
return(result);
|
||||
result = gnc_account_foreach_descendant_until (child, thunk, user_data);
|
||||
if (result) break;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user