These were not used outside a test.
And that test was not leak free, as a result of the functions not doing
what they are supposed to do when the current value is not of the type
that is expected. (NULL is returned, but the value is not replaced)
Under some build conditions boost::typeindex will use an internal type
identifier that's different from the C++ builtin. In that case type equality
tests to C++ typeid in boost::variant will fail, breaking it. Using
boost::typeindex::type_id ensures that the comparisons always work.
The core issue was that the delete visitor was never called because its parameter
type (char *) didn't match the boost::variant type (const char *).
Fixing the visitor's parameter type also require a const_cast
back to char * because that's what g_free takes as argument.
The rest of this commit is merely fixing KvpValue instantiations that
tried to create a char* KvpValue from a stack based const string instead
of a heap allocated one. That would bomb out on calling the
delete visitor.
The nested representation was very noisy. Now, the string representation
shows one line per value with the full prefix which is also more
expressive than the old version.
It is split into
- /libgnucash (for the non-gui bits)
- /gnucash (for the gui)
- /common (misc source files used by both)
- /bindings (currently only holds python bindings)
This is the first step in restructuring the code. It will need much
more fine tuning later on.