mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
[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:
@@ -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)
|
||||
|
Reference in New Issue
Block a user