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:
lmat
2017-10-05 12:48:37 -04:00
parent eb6c741bf9
commit 34e0d6cfa0
27 changed files with 98 additions and 83 deletions

View File

@@ -334,7 +334,7 @@ add_kvp_value_node (xmlNodePtr node, const gchar* tag, KvpValue* val)
auto frame = val->get<KvpFrame*> ();
if (!frame)
break;
frame->for_each_slot (add_kvp_slot, static_cast<void*> (val_node));
frame->for_each_slot_temp (&add_kvp_slot, val_node);
break;
}
default:
@@ -366,6 +366,6 @@ qof_instance_slots_to_dom_tree (const char* tag, const QofInstance* inst)
return nullptr;
ret = xmlNewNode (nullptr, BAD_CAST tag);
frame->for_each_slot (add_kvp_slot, static_cast<void*> (ret));
frame->for_each_slot_temp (&add_kvp_slot, ret);
return ret;
}

View File

@@ -21,7 +21,6 @@ extern "C"
{
#include <config.h>
#include "test-stuff.h"
#include "test-engine-stuff.h"
#include <stdlib.h>
@@ -30,6 +29,7 @@ extern "C"
#include "test-file-stuff.h"
#include "sixtp-utils.h"
#include "sixtp-dom-generators.h"
#include "test-stuff.h"
#define GNC_V2_STRING "gnc-v2"
const gchar* gnc_v2_xml_version_string = GNC_V2_STRING;

View File

@@ -30,7 +30,6 @@ extern "C"
#include <glib.h>
#include "test-stuff.h"
#include "test-engine-stuff.h"
#include "cashobjects.h"
#include "gnc-engine.h"
@@ -44,6 +43,7 @@ extern "C"
#include "sixtp-utils.h"
#include "sixtp-dom-parsers.h"
#include "sixtp-dom-generators.h"
#include "test-stuff.h"
#define GNC_V2_STRING "gnc-v2"
const gchar* gnc_v2_xml_version_string = GNC_V2_STRING;

View File

@@ -34,7 +34,6 @@ extern "C"
#include "gnc-module.h"
#include "gnc-engine.h"
#include "test-stuff.h"
#include "test-engine-stuff.h"
}
@@ -43,6 +42,7 @@ extern "C"
#include "io-gncxml-v2.h"
#include "io-example-account.h"
#include "test-stuff.h"
static const gchar* da_ending = ".gnucash-xea";

View File

@@ -45,7 +45,6 @@ extern "C"
#include <gnc-engine.h>
#include <gnc-prefs.h>
#include <test-stuff.h>
#include <unittest-support.h>
#include <test-engine-stuff.h>
}
@@ -53,6 +52,7 @@ extern "C"
#include "../gnc-backend-xml.h"
#include "../io-gncxml-v2.h"
#include "test-file-stuff.h"
#include <test-stuff.h>
#define GNC_LIB_NAME "gncmod-backend-xml"
#define GNC_LIB_REL_PATH "xml"

View File

@@ -30,7 +30,6 @@ extern "C"
#include <stdlib.h>
#include <string.h>
#include "test-stuff.h"
#include "test-engine-stuff.h"
#include "gnc-engine.h"
@@ -39,6 +38,7 @@ extern "C"
#include "test-file-stuff.h"
#include "io-gncxml-v2.h"
#include "test-stuff.h"
const char* possible_envs[] =
{

View File

@@ -24,13 +24,13 @@ extern "C"
#include <stdlib.h>
#include "gnc-engine.h"
#include "test-stuff.h"
#include "test-engine-stuff.h"
}
#include "test-file-stuff.h"
#include "sixtp-dom-parsers.h"
#include "sixtp-dom-generators.h"
#include "test-stuff.h"
#define GNC_V2_STRING "gnc-v2"

View File

@@ -32,7 +32,6 @@ extern "C"
#include <gnc-engine.h>
#include <cashobjects.h>
#include <test-stuff.h>
#include <test-engine-stuff.h>
#include <unittest-support.h>
@@ -45,6 +44,7 @@ extern "C"
#include "../sixtp-parsers.h"
#include "../sixtp-dom-parsers.h"
#include "test-file-stuff.h"
#include <test-stuff.h>
static QofBook* sixbook;

View File

@@ -28,7 +28,6 @@ extern "C"
#include "gnc-module.h"
#include "qof.h"
#include "test-stuff.h"
#include "test-engine-stuff.h"
#include "Account.h"
@@ -41,6 +40,7 @@ extern "C"
#include "sixtp-dom-parsers.h"
#include "io-gncxml-gen.h"
#include "test-file-stuff.h"
#include "test-stuff.h"
static QofBook* book;

View File

@@ -34,7 +34,6 @@ extern "C"
#include "gnc-engine.h"
#include "gnc-pricedb.h"
#include "test-stuff.h"
#include "test-engine-stuff.h"
}
@@ -45,6 +44,7 @@ extern "C"
#include "sixtp-dom-parsers.h"
#include "io-gncxml-v2.h"
#include "test-file-stuff.h"
#include "test-stuff.h"
static QofSession* session;
static int iter;

View File

@@ -38,7 +38,6 @@ extern "C"
#include <cashobjects.h>
#include <TransLog.h>
#include <test-stuff.h>
#include <test-engine-stuff.h>
#include <unittest-support.h>
@@ -53,7 +52,7 @@ extern "C"
#include "../sixtp-dom-parsers.h"
#include "../io-gncxml-gen.h"
#include "test-file-stuff.h"
#include <test-stuff.h>
static QofBook* book;
extern gboolean gnc_transaction_xml_v2_testing;

View File

@@ -23,12 +23,12 @@ extern "C"
#include <stdlib.h>
#include <string.h>
#include "test-stuff.h"
#include "test-engine-stuff.h"
}
#include "io-gncxml-v2.h"
#include "test-file-stuff.h"
#include "test-stuff.h"
#define FILENAME "Money95bank_fr.gml2"