[c++options]Really fix the gnc_option_db_lookup_string_value leak

By deleting the function and using GncOptionDbImpl::lookup_string_option
directly. It returns a string that we don't have to worry about
memory-managing.

Also create a new GncOptionDbImpl::set_string_option to replace
gnc_option_db_set_string_value.
This commit is contained in:
John Ralls
2023-03-06 11:43:50 -08:00
parent c474d81e9f
commit cdb674ebf1
4 changed files with 25 additions and 64 deletions

View File

@@ -1256,21 +1256,6 @@ gnc_option_db_book_options(GncOptionDB* odb)
N_("The electronic tax number of your business"),
empty_string);
}
const char*
gnc_option_db_lookup_string_value(GncOptionDB* odb, const char* section, const char* name)
{
auto value{odb->lookup_string_option(section, name)};
return value.empty() ? nullptr : strdup(value.c_str());
}
void
gnc_option_db_set_string_value(GncOptionDB* odb, const char* section,
const char* name, const char* value)
{
odb->set_option<std::string>(section, name, value);
}
const QofInstance*
gnc_option_db_lookup_qofinstance_value(GncOptionDB* odb, const char* section,
const char* name)