]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/configparser.cpp
Define comparator for irc::sockets::sockaddrs
[user/henk/code/inspircd.git] / src / configparser.cpp
index 6b1b47e6de10f8417c41437e8a5ebe0d97245174..2e84b1736f5aba2fa5aff7c6cbaa2edcb75997c1 100644 (file)
@@ -84,7 +84,7 @@ struct Parser
                unget(ch);
        }
 
-       bool kv(std::vector<KeyVal>* items)
+       bool kv(std::vector<KeyVal>* items, std::set<std::string>& seen)
        {
                std::string key;
                nextword(key);
@@ -149,6 +149,10 @@ struct Parser
                        else
                                value.push_back(ch);
                }
+
+               if (!seen.insert(key).second)
+                       throw CoreException("Duplicate key '" + key + "' found");
+
                items->push_back(KeyVal(key, value));
                return true;
        }
@@ -169,9 +173,10 @@ struct Parser
                        throw CoreException("Empty tag name");
 
                std::vector<KeyVal>* items;
+               std::set<std::string> seen;
                tag = ConfigTag::create(name, current.filename, current.line, items);
 
-               while (kv(items));
+               while (kv(items, seen));
 
                if (name == "include")
                {