[help_text] fix static init issue

pull/1249/head
Tim Stack 2 months ago
parent c497dc49f1
commit 884e6b7415

@ -104,10 +104,18 @@ help_text::with_prql_path(
return *this;
}
std::multimap<std::string, help_text*>&
help_text::tag_map()
{
static std::multimap<std::string, help_text*> retval;
return retval;
}
void
help_text::index_tags()
{
for (const auto& tag : this->ht_tags) {
TAGGED.insert(std::make_pair(tag, this));
tag_map().insert(std::make_pair(tag, this));
}
}

@ -250,7 +250,7 @@ struct help_text {
void index_tags();
static std::multimap<std::string, help_text*> TAGGED;
static std::multimap<std::string, help_text*>& tag_map();
};
#endif

@ -42,15 +42,13 @@
using namespace lnav::roles::literals;
std::multimap<std::string, help_text*> help_text::TAGGED;
static std::vector<help_text*>
get_related(const help_text& ht)
{
std::vector<help_text*> retval;
for (const auto& tag : ht.ht_tags) {
auto tagged = help_text::TAGGED.equal_range(tag);
auto tagged = help_text::tag_map().equal_range(tag);
for (auto tag_iter = tagged.first; tag_iter != tagged.second;
++tag_iter)

Loading…
Cancel
Save