Fix double delete in qof_instance_kvp_remove_guid and remove vestigial glist support.
In the KvpValue::Type::FRAME case if the guid matches, it does both:
delete inst->kvp_data->set_path({path}, nullptr);
delete v;
Where earlier the v was set to be:
auto v = inst->kvp_data->get_slot({path});
The second delete is a duplicate of the first and should be removed.
The collection_compare_cb function set the user_data pointer to point to a local variable
of the function. That pointer is then used in the (only) calling function
qof_collection_compare to make decisions. This is undefined. It is likely not an actual
problem because the stack depth of the qof_collection_foreach followed by
collection_compare_cb is deeper than the qof_collection_get_data call (and others
in between if any) that the stack data user data stays uncorrupted.
But, it is undefined behavior, and could cause really subtle bugs if these there are code
changes that have deeper stack between the setting and using.
Also, using this local variable is not necessary, the qof_collection_compare function
already sets up a variable local to its scope for this that the collection_compare_cb can
use directly.
This commit removes the local (to collection_compare_cb) variable and uses the one setup
in qof_collection_compare.
The full coverage test for qofid.cpp passed before and after this change.
NOTE: This does not have full coverage because the "if (!target || !ent)" body in the
collection_compare_cp function cannot be reached. There is too much safety in the rest of
the system to test this error.
NOTE: I made this a separate test from the test-engine so that I was able to check that it
by itself could test the full coverage of the qofid.cpp file. If it was part of the larger
test, I could have missed some parts that were covered incidentally elsewhere.
Boost::date_time has changed to throwing a std::out_of_range instead of a
boost::date_time::gregorian::bad_year when a date is outside of the
1400-9999 year range it can deal with.
We also recently discovered that it will use the system localtime function
when creating a new date which can lead to a 2038 failure. Use std::chrono
to resolve that problem.
* apply_xmlnode_text (node, f, optional default_val)
retrieves text; and calls and returns f(text)
on failure (i.e. node==null || node has no text), it returns default_val
* apply_xmlnode_text (node, obj, f)
retrieves text; and calls and returns f(obj, text)
on success, it will return true, on failure it returns false
Avoids allocating/g_free temporary strings when DOM text
exists. Replaces dom_tree_to_text() with dom_node_to_text() fast-path
for Account, Transaction, and Split string setters.
dom_tree_to_commodity_ref() is called for every transaction or
price. It created and destroyed a commodity only to read its namespace
and mnemonic when loading books. Rewrite to avoid creating temporary
commodity.
dom_tree_to_commodity_ref_no_engine () is called when creating
commodities.
Introduce get_commodity_ns_mnemonic() to parse namespace/mnemonic
directly, and use it in both code paths.