@@ -33,6 +33,11 @@ auto constexpr stream_max = std::numeric_limits<std::streamsize>::max();
33
33
GncOptionDB::GncOptionDB () : m_default_section{std::nullopt} {}
34
34
35
35
GncOptionDB::GncOptionDB (QofBook* book) : GncOptionDB() {}
36
+ static bool
37
+ operator ==(const std::string& str, const char * cstr)
38
+ {
39
+ return strcmp (str.c_str (), cstr) == 0 ;
40
+ }
36
41
37
42
void
38
43
GncOptionDB::save_to_book (QofBook* book, bool do_clear) const
@@ -377,23 +382,14 @@ unquote_scheme_string(const std::string& str)
377
382
return str;
378
383
}
379
384
380
- static inline bool
381
- string_equal_charptr (const std::string& str, const char * chars)
382
- {
383
- if (!chars || str.empty () || strlen (chars) != str.size ())
384
- return false ;
385
- return strcmp (str.c_str (), chars) == 0 ;
386
- }
387
-
388
385
static std::optional<std::reference_wrapper<const SchemeId>>
389
386
find_form (const SchemeId& toplevel, IdentType type, const char * name)
390
387
{
391
- if (toplevel.m_type == type &&
392
- string_equal_charptr (toplevel.m_name .c_str (), name))
388
+ if (toplevel.m_type == type && toplevel.m_name == name)
393
389
return std::ref (toplevel);
394
390
for (const auto & id : toplevel.m_ids )
395
391
{
396
- if (id.m_type == type && string_equal_charptr ( id.m_name . c_str (), name) )
392
+ if (id.m_type == type && id.m_name == name)
397
393
return std::ref (id);
398
394
auto child{find_form (id, type, name)};
399
395
if (child)
0 commit comments