X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fcore%2Ftag.cpp;h=56236c19554931c87794b7e02e1973437a715d19;hp=44c7c8f86396837ebb73c9db0ca592a71dfbff56;hb=f3ee91e70df8a7fdc68f46427bf8a28f34f0cd24;hpb=f19366d32cc29287a2730cfba90893e407754081 diff --git a/source/core/tag.cpp b/source/core/tag.cpp index 44c7c8f8..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 - auto 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);