From 370a06fb611f73ce91c2521837afdfa8eae779db Mon Sep 17 00:00:00 2001 From: Christopher Lam Date: Mon, 20 May 2024 08:05:01 +0800 Subject: [PATCH] [qofid.cpp] remove unnecessary struct --- libgnucash/engine/qofid.cpp | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/libgnucash/engine/qofid.cpp b/libgnucash/engine/qofid.cpp index f295ccec00..78fefff1df 100644 --- a/libgnucash/engine/qofid.cpp +++ b/libgnucash/engine/qofid.cpp @@ -302,40 +302,21 @@ qof_collection_set_data (QofCollection *col, gpointer user_data) /* =============================================================== */ -struct _qofid_iterate -{ - QofInstanceForeachCB fcn; - gpointer data; -}; - -static void -foreach_cb (gpointer item, gpointer arg) -{ - struct _qofid_iterate *iter = static_cast<_qofid_iterate*>(arg); - QofInstance *ent = static_cast(item); - - iter->fcn (ent, iter->data); -} - void qof_collection_foreach_sorted (const QofCollection *col, QofInstanceForeachCB cb_func, gpointer user_data, GCompareFunc sort_fn) { - struct _qofid_iterate iter; GList *entries; g_return_if_fail (col); g_return_if_fail (cb_func); - iter.fcn = cb_func; - iter.data = user_data; - PINFO("Hash Table size of %s before is %d", col->e_type, g_hash_table_size(col->hash_of_entities)); entries = g_hash_table_get_values (col->hash_of_entities); if (sort_fn) entries = g_list_sort (entries, sort_fn); - g_list_foreach (entries, foreach_cb, &iter); + g_list_foreach (entries, (GFunc)cb_func, user_data); g_list_free (entries); PINFO("Hash Table size of %s after is %d", col->e_type, g_hash_table_size(col->hash_of_entities));