[account.cpp] refactor gnc_account_get_map_entry

Have comprehensive tests in a5d101d1b
This commit is contained in:
Christopher Lam
2021-09-13 23:26:58 +08:00
parent 4309469730
commit c8a53c54f2

View File

@@ -6021,23 +6021,10 @@ gnc_account_imap_get_info (Account *acc, const char *category)
gchar *
gnc_account_get_map_entry (Account *acc, const char *head, const char *category)
{
GValue v = G_VALUE_INIT;
gchar *text = NULL;
std::vector<std::string> path {head};
if (category)
path.emplace_back (category);
if (qof_instance_has_path_slot (QOF_INSTANCE (acc), path))
{
qof_instance_get_path_kvp (QOF_INSTANCE (acc), &v, path);
if (G_VALUE_HOLDS_STRING (&v))
{
gchar const *string;
string = g_value_get_string (&v);
text = g_strdup (string);
}
}
g_value_unset (&v);
return text;
return get_kvp_string_path (acc, {head, category});
else
return get_kvp_string_path (acc, {head});
}