]> git.tdb.fi Git - libs/gl.git/blobdiff - source/core/tag.cpp
Check the flat qualifier from the correct member
[libs/gl.git] / source / core / tag.cpp
index 538190f836fb66782e03a510d0ed2f758a15057d..84eb074a4361c9d9a4888d861266f802ba778b78 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
 
 }
@@ -18,28 +22,29 @@ namespace Msp {
 namespace GL {
 
 Tag::Tag(const char *s):
-       id((s && *s) ? hash32(s, strlen(s)) : 0)
+       id((s && *s) ? hash<32>(s, strlen(s)) : 0)
 {
 #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 string &s):
-       id(s.empty() ? 0 : hash32(s))
+       id(s.empty() ? 0 : hash<32>(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);