summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2014-11-01 18:21:30 +0100
committerAttila Molnar <attilamolnar@hush.com>2014-11-01 18:21:30 +0100
commit48f8f79317a04891e2becd859363add6eb2d6444 (patch)
treef92d080a4b552df405470662a31fc5e4a923882d /src
parentfbc73e20784b055485f676096e758d6aeed62e0c (diff)
Add stdalgo::isin() and use it to simplify code
Diffstat (limited to 'src')
-rw-r--r--src/configparser.cpp2
-rw-r--r--src/logger.cpp2
-rw-r--r--src/modules.cpp2
-rw-r--r--src/modules/m_showfile.cpp2
4 files changed, 4 insertions, 4 deletions
diff --git a/src/configparser.cpp b/src/configparser.cpp
index 89ad6493a..6b0d8fa04 100644
--- a/src/configparser.cpp
+++ b/src/configparser.cpp
@@ -367,7 +367,7 @@ void ParseStack::DoReadFile(const std::string& key, const std::string& name, int
bool ParseStack::ParseFile(const std::string& path, int flags, const std::string& mandatory_tag, bool isexec)
{
ServerInstance->Logs->Log("CONFIG", LOG_DEBUG, "Reading (isexec=%d) %s", isexec, path.c_str());
- if (std::find(reading.begin(), reading.end(), path) != reading.end())
+ if (stdalgo::isin(reading, path))
throw CoreException((isexec ? "Executable " : "File ") + path + " is included recursively (looped inclusion)");
/* It's not already included, add it to the list of files we've loaded */
diff --git a/src/logger.cpp b/src/logger.cpp
index 61f1eb179..8bd5f7f88 100644
--- a/src/logger.cpp
+++ b/src/logger.cpp
@@ -288,7 +288,7 @@ void LogManager::Log(const std::string &type, LogLevel loglevel, const std::stri
for (std::map<LogStream *, std::vector<std::string> >::iterator gi = GlobalLogStreams.begin(); gi != GlobalLogStreams.end(); ++gi)
{
- if (std::find(gi->second.begin(), gi->second.end(), type) != gi->second.end())
+ if (stdalgo::isin(gi->second, type))
{
continue;
}
diff --git a/src/modules.cpp b/src/modules.cpp
index 4c0af3bac..05a1552f4 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -178,7 +178,7 @@ ModuleManager::~ModuleManager()
bool ModuleManager::Attach(Implementation i, Module* mod)
{
- if (std::find(EventHandlers[i].begin(), EventHandlers[i].end(), mod) != EventHandlers[i].end())
+ if (stdalgo::isin(EventHandlers[i], mod))
return false;
EventHandlers[i].push_back(mod);
diff --git a/src/modules/m_showfile.cpp b/src/modules/m_showfile.cpp
index 132a22267..cb51c4387 100644
--- a/src/modules/m_showfile.cpp
+++ b/src/modules/m_showfile.cpp
@@ -113,7 +113,7 @@ class ModuleShowFile : public Module
// This is our command, make sure we don't have the same entry twice
sfcmd = static_cast<CommandShowFile*>(handler);
- if (std::find(newcmds.begin(), newcmds.end(), sfcmd) != newcmds.end())
+ if (stdalgo::isin(newcmds, sfcmd))
throw ModuleException("Command " + cmdname + " is already used in a <showfile> tag");
}
else