]> git.tdb.fi Git - libs/gl.git/blobdiff - source/core/tag.cpp
Remove support for array size specialization from the engine as well
[libs/gl.git] / source / core / tag.cpp
index b5f860334e8a3792b7d8f4fe88f47e2dcd9a4e31..56236c19554931c87794b7e02e1973437a715d19 100644 (file)
@@ -9,7 +9,11 @@ using namespace std;
 namespace {
 
 #ifdef DEBUG
-map<Msp::GL::Tag, string> tag_names;
+map<Msp::GL::Tag, string> &get_tag_names()
+{
+       static map<Msp::GL::Tag, string> names;
+       return names;
+}
 #endif
 
 }
@@ -22,24 +26,25 @@ 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
 }
 
-Tag::Tag(const std::string &s):
+Tag::Tag(const string &s):
        id(s.empty() ? 0 : hash32(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<Tag, string>::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);