mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
kvp frame to template and correcting failure macro
The template avoids the need to cast to and from void*, and adds flexibility to the targeted function's signature. test-stuff.h defines a macro, "failure" which is used as an identifier in the standard IO library, so I moved any inclusion of test-stuff.h to the last include position so that "failure" wouldn't be defined before the IO library was included.
This commit is contained in:
@@ -1118,7 +1118,7 @@ static void commit_err (G_GNUC_UNUSED QofInstance *inst, QofBackendError errcode
|
||||
|
||||
#define GNC_FEATURES "features"
|
||||
static void
|
||||
add_feature_to_hash (const gchar *key, KvpValue *value, gpointer user_data)
|
||||
add_feature_to_hash (const gchar *key, KvpValue *value, GHashTable * user_data)
|
||||
{
|
||||
gchar *descr = g_strdup(value->get<const char*>());
|
||||
g_hash_table_insert (*(GHashTable**)user_data, (gchar*)key, descr);
|
||||
@@ -1134,8 +1134,8 @@ qof_book_get_features (QofBook *book)
|
||||
auto slot = frame->get_slot(GNC_FEATURES);
|
||||
if (slot != nullptr)
|
||||
{
|
||||
frame = slot->get<KvpFrame*>();
|
||||
frame->for_each_slot(&add_feature_to_hash, &features);
|
||||
frame = slot->get<KvpFrame*>();
|
||||
frame->for_each_slot_temp(&add_feature_to_hash, features);
|
||||
}
|
||||
return features;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user