X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcore%2Ftag.cpp;h=56236c19554931c87794b7e02e1973437a715d19;hb=e70662d7812464159f2e47f4bebb69d88f89ae93;hp=538190f836fb66782e03a510d0ed2f758a15057d;hpb=3a6eb030fb4eca4c2a317f270704fddf31613130;p=libs%2Fgl.git diff --git a/source/core/tag.cpp b/source/core/tag.cpp index 538190f8..56236c19 100644 --- a/source/core/tag.cpp +++ b/source/core/tag.cpp @@ -9,7 +9,11 @@ using namespace std; namespace { #ifdef DEBUG -map tag_names; +map &get_tag_names() +{ + static map names; + return names; +} #endif } @@ -22,7 +26,7 @@ Tag::Tag(const char *s): { #ifdef DEBUG if(s) - tag_names.insert(make_pair(*this, string(s))); + get_tag_names().insert(make_pair(*this, string(s))); #endif } @@ -31,15 +35,16 @@ Tag::Tag(const string &s): { #ifdef DEBUG if(!s.empty()) - tag_names.insert(make_pair(*this, s)); + get_tag_names().insert(make_pair(*this, s)); #endif } string Tag::str() const { #ifdef DEBUG - map::const_iterator i=tag_names.find(*this); - if(i!=tag_names.end()) + const auto &names = get_tag_names(); + auto i = names.find(*this); + if(i!=names.end()) return i->second; #endif return format("Tag(%d)", id);