summaryrefslogtreecommitdiff
path: root/src/logger.cpp
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2014-11-01 18:17:04 +0100
committerAttila Molnar <attilamolnar@hush.com>2014-11-01 18:17:04 +0100
commitfbc73e20784b055485f676096e758d6aeed62e0c (patch)
tree8251c8473af414527becb989558a69c4e7dc49b4 /src/logger.cpp
parent5fb509060fa7552a25efccad11595898d420d476 (diff)
Add stdalgo::erase() and use it to simplify code
Diffstat (limited to 'src/logger.cpp')
-rw-r--r--src/logger.cpp10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/logger.cpp b/src/logger.cpp
index bf4ef582a..61f1eb179 100644
--- a/src/logger.cpp
+++ b/src/logger.cpp
@@ -207,10 +207,9 @@ void LogManager::DelLogStream(LogStream* l)
{
for (std::map<std::string, std::vector<LogStream*> >::iterator i = LogStreams.begin(); i != LogStreams.end(); ++i)
{
- std::vector<LogStream*>::iterator it;
- while ((it = std::find(i->second.begin(), i->second.end(), l)) != i->second.end())
+ while (stdalgo::erase(i->second, l))
{
- i->second.erase(it);
+ // Keep erasing while it exists
}
}
@@ -236,11 +235,8 @@ bool LogManager::DelLogType(const std::string &type, LogStream *l)
if (i != LogStreams.end())
{
- std::vector<LogStream *>::iterator it = std::find(i->second.begin(), i->second.end(), l);
-
- if (it != i->second.end())
+ if (stdalgo::erase(i->second, l))
{
- i->second.erase(it);
if (i->second.size() == 0)
{
LogStreams.erase(i);